Search Paths
What is a search path?
You can run a Unix command by name (e.g. "ls") instead of specifying the full path name (e.g. "/usr/bin/ls") if the command's location (e.g., for ls: "/usr/bin") is in your search path.
A command search path is simply a list of directories where your shell will look to find a command. For example, assume I type the command "ls", and my search path is:
~/bin /local/paths /none/such /usr/bin /etc
The system first looks in ~/bin (which corresponds to /home/staff/anne/bin, since the "~" is shorthand for "my home directory"), but I have no file "ls" in my bin directory. The system then looks in /local/paths, but there is no "ls" there either. The system tries to look in /none/such, but there is no such directory, so the system skips that and moves on to /usr/bin. Since there is a /usr/bin/ls, that is the command that is run. "/etc" is ignored, since the needed command has already been found, and the first one found is used.
[NOTE: Your home directory will be something like /home/ugrad/your_name, the second level subdirectory signifying what user group you belong to.]
Your command search path is usually set from your shell's start-up file. For csh and tcsh users, the start-up file is .cshrc; for sh users, it is .profile.
Menushell users will generally have a search path set in their .menurc file, but this will be overridden by the path setting in .cshrc or .profile (depending on the user's preferred shell, as established using the "Set Preferences" menu).
Feel free to change your search path if you like. In .cshrc look for the line containing:
set path=. . .
or, in .profile, look for the line containing:
PATH=. . .
Follow the syntax that is used -- in particular, don't insert any line breaks, unless you use the continuation character "\" at the end of the broken line, to indicate that the command continues on the next line.
If you are having problems with finding commands, chances are that you've modified the relevant startup file on your account. If you've edited .cshrc or .profile yourself, you may have to go back and ensure that the changes haven't prevented you from gaining access to the software you're trying to use. You can get a copy of a correct .cshrc or .profile in /local/etc/prodef.
More information about the "path" variable is available in the man page for the C shell, in other words by typing "man csh".
|
Copyright, © 2003,
Concordia University,
(IITS).
|
|
|