Once the shell has processed all of its special characters, what remains typically consists of commands and the arguments to them. Most commands correspond to executable files somewhere on your system, although some—such as cd—are built into the shell.
Give us the tools, and we will finish the job.—Sir Winston Churchill
It's possible for you to have more than one executable file with the same name on your system. The shell uses the PATH environment variable to determine which version to use.
The value of PATH is a list of directories, separated by colons (:), in the order in which you want the shell to search for executables. To see the value of your PATH, type:
echo $PATH
If you want to have your current directory in your PATH, make sure that you put it after the directories that hold the common utilities.
For information about setting your PATH, see Environment variables in Configuring Your Environment.
If you want to know which version of a command the shell will choose, use the which command. For example:
$ which ls /bin/ls
You can use command-line options to get more information:
$ which -laf ls -rwxrwxr-x 1 root root 19272 May 03 2002 /bin/ls
If you try this for a command that's built into the shell, which can't find it:
$ which cd which: no cd in /bin:/usr/bin:/opt/bin
The whence command displays what the command means to the shell, including any aliases in effect. For example, if you've created an alias for ls, the output might be:
$ whence ls 'ls -F'