Setting your Unix Search Path

When you type a command to the UNIX shell, it searches a sequence of directories to look for an executable of that name. The sequence of directories is called your search path. The first matching executable is the one executed by the shell.

Your search path is specified by the value of the environment variable PATH. When you change that variable, you change the way the shell find commands. By adding to the front of the variable, you can override the location of various commands in order to use other versions of them.

To add a directory new-dir to the front of your UNIX search path, do the following

  • For csh, tcsh: Add the following to ~/.cshrc:
   setenv PATH new-dir:$PATH

  • For sh, bash: Add the following to ~/.profile:
   PATH=new-dir:$PATH
   export PATH

If you don't know what shell you're using, try:

    echo $SHELL

-- GeorgeFerguson - 05 May 2005


This topic: Main > WebLeftBar > TechTalk > SoftwareStuff > SoftwareFromGeorge > SettingUnixSearchPath
Topic revision: r1 - 2005-05-05 - GeorgeFerguson
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback