About Linux FAQ

Browse More FAQs:

UNIX / Linux: Set your PATH Variable using set or export command

Posted by Vivek Gite [Last updated: August 12, 2008]

Q. How do I add new path to PATH variable under Linux and UNIX operating system?

A. The syntax for setting path under UNIX / Linux dependent on which shell you are using. BASH / SH shell uses following syntax:
export PATH=$PATH:/path/to/dir1:/path/to/dir2

For tcsh or csh, shell enter:
set PATH = ($PATH /path/to/dir1 /path/to/dir2)

You can type above command at the terminal or add it to your .bashrc (for BASH/sh shell) or .cshrc (for chs / tcsh shell) so that PATH can be set each time you login into box. For example add /usr/local/bin to your path under BASH, enter:
export PATH=$PATH:/usr/local/bin
Or add as follows to your .bashrc file:
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc
If you are using CSH / TCSH, enter:
echo 'set PATH = ($PATH /usr/local/bin /scripts/admin)' >> ~/.cshrc
To display path settings, enter:
$ echo $PATH

E-mail    Print    Can't find an answer to your question? Contact us

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tags: , , , , , , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Powered by Open source software.