UNIX / Linux: Set your PATH Variable using set or export command
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!
Tags: BASH Shell, bashrc, csh shell, cshrc, echo, export command, export path, export PATH=$PATH:$JAVA_HOME/bin, path path, path settings, set command, set PATH, shell path command, tcsh shell, unix operating system



Recent Comments
Today ~ 88 Comments
Today ~ 6 Comments
Today ~ 7 Comments
11/07/2008 11:19 am (4 weeks ago) ~ 7 Comments
Today ~ 5 Comments