Technology Sharing

[Linux] The essence of commands in Linux

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Last time we talked about Linux commands. This article is a short one, mainly explaining the essence of commands.

We know that commands are generally used directly

The executable program needs to add the current path

(This mytest is what we wrote last time, and its actual function is to print Hello world!)

We can intuitively find that Linux commands do not need to write the current path.

But in fact, the essence of commands is executable files. In fact, these commands are stored in the bin directory. We can

ls bin

Found these executable files, and it is not difficult to see that these are commands

If you don't believe it, we can try this:

We enter the bin directory in the root directory and run the ls executable file. The effect is the same as using the ls command directly.

Let's add our own executable file to the bin folder and see if it can be used as a command.

We will find that the results are the same. What does this prove? The so-called command is an executable file stored in the bin directory.

Now that we have talked about this, in fact, what we just did is to install it to the system. The essence of installation is copying. The installation progress bar we usually see is actually completing the corresponding copy, copying executable programs, configuration files and the like, so you will be asked to select the corresponding drive letter.

So, now we are going to uninstall our software

After deletion, our mytest will not be usable.

So why do we need to add ./ when we execute our own executable program?

./ is the current directory. Adding ./ means executing the executable file we need in the current directory.