When the shell gets a command, it will try to search for it in the following categories.
Commands that are used very often are built into the shell. Commands like this are pwd, history, test, echo and etcetera. These exist also in binary form inside the /bin folder; however, unless explicitly asked for, they will not be used.
This will speed up their execution a little. After this, the shell will search between the functions. For a task that we use multiple times, we can define a function inside the shell. We will discuss this later on.
External commands are the third category of command. This are the commands that can be found somewhere in the file system. Of course, the shell will not search in all the folders, just a couple determined inside the PATH environment variable.
The final and fourth category is aliases. The aliases replace the names for a command. This helps us to replace a long command line with a shorter one. To assign a new alias, we will use the alias command with the following syntax:
alias [name of the alias]='[whit what]'
When there is an alias and a command name, the aliases have priority. A general example for this is an alias that is already active on most of the UNIX systems. It is about the colorful text of the file list. You probably noticed that if you use ls, files will be colored based on their traits. This is because the following alias is automatically made:
alias ls='ls -color=tty'
As you can see, the alias assigns a name to a string. The shell will replace, on the command line, the command name with this assigned string. If we use the alias command with no arguments, it will print back the already-set aliases. We can use the unalias to unset aliases. For example for the upper one the unset command is:
unalias ls
If you want to read the help files for a command/tool, you can search for them in two places. If the command is built into the shell, you can find the files with the help command; if it is a tool that exists in a binary file, there will be a man (manual) file for it. You can call this with the man command. You can exit from this help by pressing Q in the terminal.