A message of Command not found indicates one of the following:
The command is not available on the system.
The command directory is not in the search path.
To fix a search path problem, you need to know the pathname of the directory where the command is stored.
If the wrong version of the command is found, a directory that has a command of the same name is in the search path. In this case, the proper directory may be later in the search path or may not be present at all.
You can display your current search path by using the echo $PATH command.
$ echo $PATH /home/kryten/bin:/sbin:/usr/sbin:/usr/openwin/bin:/usr/openwin/bin/xview: /usr/dist/local/exe:/usr/dist/exe |
Use the which command to determine whether you are running the wrong version of the command.
$ which maker /usr/doctools/frame5.1/bin/maker |
The which command looks in the .cshrc file for path information. The which command may give misleading results if you execute it from the Bourne or Korn shell and you have a .cshrc file than contains aliases for the which command. To ensure accurate results, use the which command in a C shell, or, in the Korn shell, use the whence command.
Display the current search path to verify that the directory for the command is not in your path or that it isn't mispelled.
$ echo $PATH |
Check the following:
Is the search path correct?
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.
Activate the new path as follows:
Shell |
File Where Path Is Located |
Activate The Path With ... |
---|---|---|
Bourne and Korn |
.profile |
$ . ./.profile |
C |
.cshrc |
hostname% source .cshrc |
|
.login |
hostname% source .login |
Verify the path using the command shown below.
$ which command |
This example shows that the OpenWindows executable is not in any of the directories in the search path using the which command.
venus% openwin Command not found venus% echo $PATH no openwin in . /home/ignatz /sbin /usr/sbin /usr/bin /etc /home/ignatz/bin /bin /home/bin /usr/etc venus% vi ~.cshrc (Add appropriate command directory to the search path) venus% source .cshrc venus% openwin |
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.