Display the current search path to verify that the directory for the command is not in your path or that it isn't misspelled.
$ echo $PATH |
Check the following:
Is the search path correct?
Is the search path listed before other search paths where another version of the command is found?
Is the command in one of the search paths?
If the path needs correction, go to step 3. Otherwise, go to step 4.
Add the path to the appropriate file, as shown in this table.
Shell |
File |
Syntax |
Notes |
---|---|---|---|
Bourne and Korn |
$HOME/.profile |
$ PATH=$HOME/bin:/sbin:/usr/local /bin ... $ export PATH |
A colon separates path names. |
C |
$HOME/.cshrc or $HOME/.login |
hostname% set path=(~bin /sbin /usr/local/bin ...) |
A blank space separates path names. |
Activate the new path as follows:
Shell |
File Where Path Is Located |
Use this Command to Activate The Path |
---|---|---|
Bourne and Korn |
.profile |
$ . ./.profile |
C |
.cshrc |
hostname% source .cshrc |
|
.login |
hostname% source .login |
Verify the new path.
$ which command |
This example shows that the mytool executable is not in any of the directories in the search path using the which command.
venus% mytool mytool: Command not found venus% which mytool no mytool in /sbin /usr/sbin /usr/bin /etc /home/ignatz/bin . venus% echo $PATH /sbin /usr/sbin /usr/bin /etc /home/ignatz/bin venus% vi ~.cshrc (Add appropriate command directory to the search path) venus% source .cshrc venus% mytool |
If you cannot find a command, look at the man page for its directory path. For example, if you cannot find the lpsched command (the lp printer daemon), lpsched(1M) tells you the path is /usr/lib/lp/lpsched.