Add directories to your search path.

If you find out that the program you want to run is in a directory that isn’t in your command search path, you can add that directory to your search path.

For example, suppose you want to run the vn program, but you get “Command not found”:

% vn
vn: Command not found.

Using whereis, you might learn that vn is installed in

/usr/local/bin:
% whereis vn
vn: /usr/local/bin/vn

You can always run the vn program using its full pathname of /usr/local/bin/vn. But if you want to run it just by typing vn, then you have to add the directory to your search path.

The way you do this depends on how you are configured. What you need to do is look for a file in your home directory called .cshrc, .profile, .bashrc, .tcshrc, etc.

In the file, you should see a line containing a list of directories. For example, in a .cshrc or .tcshrc file , you may see a line resembling:

set path=(/bin /usr/bin /usr/bin/X11)

In .profile or .bashrc, you might see a line like this:

PATH=/bin:/usr/bin:/usr/bin/X11

In one case, the directories are separated by spaces and placed within parentheses. In the other, directories are separated by colons.

To add a new directory, just put it at the end of the list. For example, to add /usr/local/bin, you would change the above lines to read either:

PATH=/bin:/usr/bin:/usr/bin/X11:/usr/local/bin
or:
set path=(/bin /usr/bin /usr/bin/X11 /usr/local/bin)

The next time you log in after editing your startup file, you will be able to run the vn command, as well ...

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.