Friday, February 10, 2012

Setting PATH variable in SUSE linux

Usually for your local settings, favorite global aliases, VISUAL and EDITOR variable, PATH environment variable and more, you can create a file /etc/profile.local in SuSE Linux.  SuSE Linux doesn't recommend you to change /etc/profile as there are the chances that your changes will be lost during system upgrades.


#vim  /etc/profile.local
PATH=$PATH:/path/to/wherever
export PATH

Log-out and log-back in.

#echo $PATH

You will see that your PATH variable has been updated.


Practical Application:

I write various scripts for system administration. I like my scripts to be in one place. I don't want to go that that folder each time to run the script. I want to execute those scripts no matter where I am.

Say, my scripts are in /usr/local/bin/myscripts

#vim  /etc/profile.local
PATH=$PATH:/usr/local/bin/myscripts
export PATH

Now I logged-out and logged-back in. I can run my scripts within myscripts folder anywhere I like.