A common misconception is that things like mkdir, rm or adduser are different from things you install in your system (e.g. postgresql, or mongod).

They are not.

All of them are programs. Some already come installed, and others you have to install yourself.

You can find out where a program executable lives using the which program:

$ which mkdir
/bin/cd
$ which which
/usr/bin/which

However, there are some built-in commands in the Bourne Again SHell (BASH). They are not very many:

  • alias;
  • cd;
  • wait;
  • and a few others

If you try executing which cd, chances are it will not be found, because it is using the built-in command, as opposed to a program.

Some built-in commands, such as kill, are sometimes overwritten by the distribution.

It is important that you know which commands are available to you. Some consoles may not use BASH, and so the cd command might not be available. An example of this is the Windows console, which uses chdir instead.

Most Linux distributions use BASH, so you won’t have a problem with that.

Getting help

Most Linux distributions come with a very handy program called man. You can use this program to get the help pages of many other programs.

For example, execute the following command:

man mkdir

You can even get the help pages on BASH built-in commands:

man cd

It was a short blog post today, but the key thing to remember is that the commands you are executing in your console are really programs which have been installed in your system. They can be un-installed, they can be overwritten, or they can just not be there yet.

You can install programs such as man and other programs that you might expect to already be there. We'll get to package managers in the next post!