Click to See Complete Forum and Search --> : Linux equivalent of autoexec.bat


mfghazi
11-30-2000, 09:34 PM
I want to set the path variable for Linux. How should I do this?

------------------
Ghazi, Muhammad Farhan

bdl
11-30-2000, 09:42 PM
Your $PATH variable is set for you with /etc/profile, but you can either change it by editing that file or creating your own $HOME/.profile and adding the path you want.

## example .profile ##

PATH="$PATH:$HOME/bin:/some/other/path"

## eof

Notice the $PATH: enclosed in the variable assignment - this ensures your already established default path gets "copied" over to your new path setting, allowing you to use the /bin, /usr/local/bin, etc. directories. Personally I think the best search path to add is a bin directory in each user's dir ($HOME/bin), that way you can have your own binaries and scripts kept seperate from the rest of the system.

scott_R
11-30-2000, 09:49 PM
export PATH="$PATH:/yourpath"

That should set it. To see your other paths, type:

echo $PATH

I'm not sure where these are stored...

------------------
RTFM=Rewrite The F***ing Manual
For more info, visit http://rute.sourceforge.net/

pinbox
09-10-2001, 02:28 AM
what will be the effect if you decided to set the environment variables in the .bashrc or .bash_profile instead?

bdg1983
09-10-2001, 02:55 AM
Originally posted by pinbox:
<STRONG>what will be the effect if you decided to set the environment variables in the .bashrc or .bash_profile instead?</STRONG>

Good question.

Using .bashrc or .bash_profile will only effect that particular user while changing the PATH in /etc/profile will change it globally (for all users).