Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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...
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.
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.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.