Monday 23 May 2011

Setting the PATH in linux.

The reason I am posting this is that as I was migrating from Windows to Linux, I had to configure the PATH variable, as I have to set the development environment and I have not been able to find the straight forward answer, on how to set the Linux PATH variable:

Using openSUSE 11.4

Checking the existing value of the PATH variable:
Just to see what does it look like currently(you can even skip this, nothing exciting):
use echo command.

root:~ # echo $PATH
it will be something like this:
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin 

Setting the PATH variable value temporarily:
Lets say you want to set the "eclipse" command to the PATH.
"eclipse" command is in the folder /home/userOne/eclipseFolder
root:~ # $PATH":/home/userOne/eclipseFolder"

The above statement will append :/home/userOne/eclipseFolder to the existing value of the PATH.

Setting the PATH variable value permanently:
We will be defining the variable in the following file:
/etc/bash.bashrc.local
If the above file does not exists, then create it.

The following are the contents of this file(bash.bashrc.local)



#setting path for tomcat home directory and exporting it.
export CATALINA_HOME=/home/nyatui/tomcatPack/tomcat6         

#setting path for eclipse home directory
ECLIPSE_HOME=/home/nyatui/eclipse

PATH=$PATH:$ ECLIPSE_HOME
export  PATH

I hope this helps someone :)
              









No comments:

Post a Comment