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 as any other command that is installed in /usr/local/bin.

The only thing to be careful of in adding new directories is that you don’t accidentally insert a carriage return (which is easy to do if you use an editor like vi that automatically wraps lines). If you do want to include a carriage return within your search path, precede the carriage return with a backslash ().

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset