[wplug] $PATH variables

Zach Paine zman at wplug.org
Sun Oct 14 13:22:05 EDT 2001


> 1) What are they, and what are they used for?

First, there is only one $PATH variable.  It's actually very simple.  It is a
shell environment variable that defines where to look for executables.  A
default path will usually include /usr/bin, /usr/local/bin, and /bin.
Basically anytime you run a command, your shell (probably bash) looks for that
command in one of the directories specified in your $PATH.  This is why you
can run 'ls' without specifying the full path to ls: /bin/ls.  

> 2) How do I change them?

You can run 'echo $PATH' to see your existing path.  It is a colon seperated
list of directories.  It will look something like this:

/usr/local/bin:/usr/bin:/usr/bin/X11:/usr/games:/sbin

To change your path, run:

export PATH="$PATH:/new/directory"

This maintains the current contents of your path and adds /new/directory to
it.  If you were to run echo $PATH now, you would see:

/usr/local/bin:/usr/bin:/usr/bin/X11:/usr/games:/sbin:/new/directory

Hope this all helps.


-- 
Zach Paine

For info on getting my PGP/GPG public key see:
http://www.wplug.org/~zman/key.htm



More information about the wplug mailing list