LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-26-2005, 07:55 PM   #1
true_atlantis
Member
 
Registered: Oct 2003
Distribution: fedora cor 5 x86_64
Posts: 639

Rep: Reputation: 30
where is PATH defined for all users?


i know i can add to the PATH in the .bash_profile, but lets say i want all users to have something added. where can i add a directory for everyone? thanks
 
Old 08-26-2005, 07:58 PM   #2
bosewicht
Senior Member
 
Registered: Aug 2003
Location: Honolulu, HI
Distribution: Arch
Posts: 1,380

Rep: Reputation: 47
You can change the PATH for all users by editing the file /etc/profile and adjusting (as root) the line starting with "PATH=".
 
Old 08-26-2005, 08:08 PM   #3
true_atlantis
Member
 
Registered: Oct 2003
Distribution: fedora cor 5 x86_64
Posts: 639

Original Poster
Rep: Reputation: 30
ok, thanks... now, i have run into another problem... i need to add my java directory (/usr/java/jdk1.5.0_04/bin) into my PATH, but i know i will be installing newer versions when they come up. what would be the easiest way to add this to my PATH? i want to make it so that i will not have to keep changing things (sym links, files) when i install newer versions. any ideas? thanks...
 
Old 08-26-2005, 08:22 PM   #4
bosewicht
Senior Member
 
Registered: Aug 2003
Location: Honolulu, HI
Distribution: Arch
Posts: 1,380

Rep: Reputation: 47
you can just set the path when you compile.
 
Old 08-26-2005, 10:48 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
The global (all user) path file is actually /etc/ld.so.conf. If you want a particular directory which contains executable files available to all users, add that directory to /etc/ld.so.conf.

If you edit various and sundry .profiles, only the profiles edited will have the directory.

If you want to limit access, edit the individual users' .profile. If you want all users to have access, edit /etc/ld.so.conf.

To quickly edit your individual PATH, you could try this:

PATH=$PATH:/usr/java/jdk1.5.0_04/bin
export PATH

You will have to do that every upgrade. Or, edit /etc/ld.so.conf to add the path to the new jdk.
 
Old 08-31-2005, 07:34 AM   #6
Hombre
LQ Newbie
 
Registered: Aug 2005
Location: Brisbane, Australia
Distribution: Fedora Core 4
Posts: 17

Rep: Reputation: 1
Well, I for one am really confused now. So far I gather:

~/.bash_profile - user login.

~/.bashrc - user shell start

etc/profile - Global

etc/ld.so.conf - Global

etc/rc.d/...? - Global

So there seems to be a few places to edit global paths and variables. What's the diff? And of course, I assume the bash profiles are for bash, but there are other shells too, so is there anything general for all shells? And so on.

Last edited by Hombre; 08-31-2005 at 10:42 PM.
 
Old 08-31-2005, 10:10 PM   #7
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
One of the things with Linux is there are many different ways to acomplish the same thing.

Normally, either ~/.bashrc or ~/.bash_profile is used for changes to an individual users environment. .bashrc is used everytime you start a shell, .bash_profile is only used when you start a login shell (ie login with a text console). Since you most likely have a graphical login, use .bashrc.

/etc/profile is used for global changes. It is the same as ~/.bash_profile, but for global changes.

AKAIK, other files are not used for bash. Other shells have similar files, such as ~/.cshrc ro tcsh etc.

I hope this helps
--Ian

Last edited by IBall; 08-31-2005 at 10:15 PM.
 
Old 09-02-2005, 11:33 AM   #8
Hombre
LQ Newbie
 
Registered: Aug 2005
Location: Brisbane, Australia
Distribution: Fedora Core 4
Posts: 17

Rep: Reputation: 1
If I look in my etc/profile it makes also a reference to etc/bashrc. In these files it makes a distinction:

/etc/profile - System wide environment and startup program
/etc/bashrc - System wide functions and aliases - login setup.

One concern I have at the moment is that I have directories in my path that I don't want. There are incorrect entries that I need to remove but I can't find where they are set. At one stage someone recommended some utilities that managed paths for me which I used to add directories, but now I cant remember what it was, not that I understood it at the time anyhow.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Java to root users PATH? infornography Linux - Newbie 5 05-26-2005 08:49 AM
remove directory from a users PATH reddazz Linux - General 4 01-14-2005 11:29 AM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 07:10 PM
JAVA_HOME path not set for all users tantric Linux - Software 5 03-29-2004 02:25 PM
Globally set PATH for all users glock19 Red Hat 8 11-09-2003 03:25 PM


All times are GMT -5. The time now is 05:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration