When you run a program at the command line, bash actually searches through
a list of directories to find the program you requested. For example, when you
type ls
, bash doesn't intrinsically know that the ls
program lives in /usr/bin
. Instead, bash refers to an environment
variable called PATH
, which is a colon-separated list of
directories. We can examine the value of PATH
:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin
Given this value of PATH
(yours may differ), bash would first
check /usr/local/bin
, then /usr/bin
for the
ls
program. Most likely, ls
is kept in
/usr/bin
, so bash would stop at that point.