Dec 17, 2010

set PATH in Linux/Unix

To set "/home/k" as PATH,
    export PATH=$PATH:/home/k

To display current PATH,  
    echo $PATH

To set permanent PATH,
(1) vim  $HOME/.profile     or    vi  .bash_profile   (in root directory (account home))
(2) add  "export PATH=$PATH:/home/k"  in the text file
(3) save 


details of  "export PATH=$PATH:/home/k" 
$PATH -  current PATH
: -  divider between PATH


It is possible to set variable as PATH.  For example,
LAMMPSHOME=/usr/global/lammps
PATH=$PATH:$LAMMPSHOME/bin

No comments:

Post a Comment