next up previous
Next: Changing PATH Up: Internal and External Commands Previous: Internal and External Commands

PATH

The search path is set up in the environment variable PATH. To see the content of PATH, i.e. all pathnames available to shell, type echo $PATH

or

printenv PATH

After typing the above command, the search path will look like:
/bin:/usr/bin:/.software/local/.admin/bins/bin: usr/openwin/bin
where ':' distinguishes between different pathnames. As mentioned before, the shell seeks the program name in directories set in PATH. The PATH is searched sequentially. For example, if PATH=/bin:/usr/bin:/... shell starts to look for the program in /bin, then /usr/bin etc. At the moment the program is found, it is executed. Presence of the /bin directory in the PATH is essential, for all external UNIX commands are located there. By default, the current directory is not in the PATH. It can be added to the PATH, but it is not recommended. Why?


Instructional Support Group 2008-08-05