Search

How to set path? PDF Print E-mail
User Rating: / 3
PoorBest 
How to ? - General
Thursday, 09 July 2009 17:08

There are many system variables in linux also called environment variables. You can see all the system variables in your linux by typing command at the console

 

env

 

 

 

One of the important system variable is PATH. Display the value of PATH variable by typing

 

echo $PATH

 

 

 

When typing the command at the terminal, it will search for the binary file corresponding to the command in the directories saved in the PATH variable. Each directory is seperated by a ':'. It will search the directories in the order starting from the left. So it is important to where the directory should be appended. If there are two binaries with the same name in two directories say /a and /b which are added to PATH, the binary which is in /a only will be executed if it lists first in the PATH variable.

To add the directory say '/a' to the front of the PATH use the command

 

PATH= /a:$PATH

export PATH

 

To add the directory to the end

 

PATH=$PATH:/a

export PATH

 

By using the above commands the path is set only for that session. To permenantly set the PATH we must edit the .basrc file in the home directory and add any one of the above command to the file.



Add this page to your favorite Social Bookmarking websites
 
Last Updated on Monday, 13 July 2009 07:32
 

Add comment


Security code
Refresh

We have 66 guests online