PAUSE
ENCORE5
ENCORE
BOX
ILLUSTRATION
GO
A pathname is a path from the root to the specified file:
/
|
------------------------
/ / | \ \
/ / | \ \
bin etc usr
|
---------------------------
/ / | \ \
/ / | \ \
bin lib local its
|
-----------------
/ | \
/ | \
bin lib its
lib
tmp
proj1
The pathname /usr/local/its is shown above:
/
|
------------------------
/ / | \ \
/ / | \ \
bin etc usr
|
---------------------------
/ / | \ \
/ / | \ \
bin lib local its
|
-----------------
/ | \
/ | \
bin lib its
lib
tmp
proj1
The Shell variable PATH tells the Shell in which
directories to look for a command.
If the PATH value is .:/bin:/usr/bin:
and if the current directory is /usr/lib, then the Shell will
first look for the command in the current directory, i.e.:
/
|
------------------------
/ / | \ \
/ / | \ \
bin etc usr
|
---------------------------
/ / | \ \
/ / | \ \
bin lib local its
|
-----------------
/ | \
/ | \
bin lib its
lib
tmp
proj1
and if the command is not found in the current directory,
then the Shell will look for it in the /bin directory.
/
|
------------------------
/ / | \ \
/ / | \ \
bin etc usr
|
---------------------------
/ / | \ \
/ / | \ \
bin lib local its
|
-----------------
/ | \
/ | \
bin lib its
lib
tmp
proj1
and if the command is not found in that directory, then the
Shell will look for it in the /usr/bin directory.
/
|
------------------------
/ / | \ \
/ / | \ \
bin etc usr
|
---------------------------
/ / | \ \
/ / | \ \
bin lib local its
|
-----------------
/ | \
/ | \
bin lib its
lib
tmp
proj1
One can change the command search path by giving $PATH a new value.
To add /usr/local/bin to the search path, you would simply type:
PATH=.:/bin:/usr/bin:/usr/local/bin or PATH=$PATH:/usr/local/bin
The /usr/local/bin addition to the PATH
variable would produce another path as shown above.
/
|
------------------------
/ / | \ \
/ / | \ \
bin etc usr
|
---------------------------
/ / | \ \
/ / | \ \
bin lib local its
|
-----------------
/ | \
/ | \
bin lib its
lib
tmp
proj1