Fedora Linux Support Community & Resources Center
Old 18th April 2012, 07:46 PM
neocortex Offline
Registered User
Join Date: Sep 2011
Posts: 30
Where and how to put a PATH= variable?

Hello ALL!
I am trying to put a system-wide PATH= variable, but nothing seems to work.
Firstly, I added a lines in /etc/profile. Somewhere here:
# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
    pathmunge /sbin after
Then, I removed these lines, and added sh-script in /etc/profile.d/ with something like (this is what I've found in one post; example is with JDK):
echo 'export JAVA_HOME=/opt/jdk1.5.0_12' > /etc/profile.d/jdk.sh
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile.d/jdk.sh
source /etc/profile.d/jdk.sh
That did not work either. So, I wonder how to put permanent and system-wide PATH=?

Thanks in advance!
Reply With Quote
Old 25th April 2012, 10:15 AM
sea Offline
"Shells" (of a sub world)
Join Date: May 2011
Location: Confoederatio Helvetica (Swissh)
Age: 37
Posts: 4,277
Re: Where and how to put a PATH= variable?

I'd suggest to add your PATH variables to your $HOME/.bashrc
If you are required to log in as root in terminal, and do need those paths from root account too, edit the /etc/bashrc with root rights.

Simplest is to directly add them there.
Adding them to /etc/profile.d/script.sh works too, but there is no need to source it from there (loop), as these scripts are read EVERY time you open a terminal, or log in, or something alike.

The simplest, and imho savest, way to add your own PATH, is like the next few lines in ~/.bashrc:
export PATH=$JH:$PATH
Hope this helps.
EFI Cheatsheet :: http://forums.fedoraforum.org/showthread.php?t=298546
Video Handler Script (VHS) (mass re-encode videos, screenrecorder, console music/webradio player, ...) :: http://forums.fedoraforum.org/showthread.php?t=299182
Windows 8+ & Fedora 20+ Dualboot :: http://forums.fedoraforum.org/showthread.php?t=298161
Reply With Quote
Old 25th April 2012, 02:03 PM
marriedto51 Offline
Registered User
Join Date: Jul 2009
Location: England, UK
Posts: 969
Re: Where and how to put a PATH= variable?

The way I set system-wide shell settings is to add a script to the /etc/profile.d directory.

I think to do what you want, I would use a text editor to create a new file java-path.sh somewhere in my home directory, which contains
export JAVA_HOME
Next, copy this into /etc/profile.d with
su -c 'cp java-path.sh /etc/profile.d/'
Now restart the shell. (Close the current terminal, and open a new one; or log out and in again.) Test that the settings have taken hold with
Reply With Quote

path, variable

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH variable gbaldeck Using Fedora 3 27th February 2010 09:26 PM
path variable michaelcarlson Using Fedora 2 14th August 2006 03:02 PM
In FC4 where is the $PATH variable set. d2e2 Using Fedora 12 18th September 2005 06:02 PM
$PATH variable fkar Using Fedora 6 1st February 2005 04:41 PM
PATH Variable flyer2000 Using Fedora 4 25th September 2004 05:29 PM

Current GMT-time: 04:06 (Sunday, 20-08-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat