LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   where is PATH defined for all users? (https://www.linuxquestions.org/questions/linux-newbie-8/where-is-path-defined-for-all-users-357371/)

true_atlantis 08-26-2005 06:55 PM

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

bosewicht 08-26-2005 06:58 PM

You can change the PATH for all users by editing the file /etc/profile and adjusting (as root) the line starting with "PATH=".

true_atlantis 08-26-2005 07:08 PM

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...

bosewicht 08-26-2005 07:22 PM

you can just set the path when you compile.

bigrigdriver 08-26-2005 09:48 PM

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.

Hombre 08-31-2005 06:34 AM

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.

IBall 08-31-2005 09:10 PM

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

Hombre 09-02-2005 10:33 AM

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.


All times are GMT -5. The time now is 01:36 PM.