Solving Problems With Search Paths
When you try to access a command, you might get the wrong version of the
command or the message Command not found might display.
In order to fix a search path problem, you need to know the pathname of the
directory where the command is stored. Check the man page for the command to see its
typical location.
Accessing an Incorrect Version of the Command
If the wrong version of the command is found, a directory including the same
command name is in your search path. The correct directory might appear later in
the search path or may not be included at all.
How to Diagnose and Correct Search Path Problems
-
Determine which version of the command you are using.
For example:
$ which acroread
/usr/bin/acroread
-
Display the current search path.
$ echo $PATH
-
Check the current search path to see whether the correct directory
is included and whether other directories including the same command
name are listed before the correct directory.
-
In the path listed in the .profile file in
your home directory, either add the correct directory or move the
correct directory to
an
earlier
position
in the path.
Use a colon to separate path names.
-
(Optional) If you need to use the command before your next system
login, activate the new path.
$ . $HOME/.profile
-
(Optional) If you have activated the new path, verify that the
command will be accessed through the correct path.
$ which command
Accessing Commands That Are Not Found
The error message Command Not Found is displayed
due to
one
of the following reasons:
If the command is not available on the system, contact your system
administrator.
How to Include a Search Path in Your Path
-
Display the current search path and make sure that the directory
for the command is not in your path or that the path is not
misspelled.
echo $PATH
-
Add the directory for the command to the PATH
entry in the $HOME/.profile file.
Use a colon to separate path names.
-
Activate the new path.
$ . $HOME/.profile
-
Verify that the correct path is now displayed for the
command.
$ which command