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'm new to linux, I've just setup my Fedora 4. Just wondering how to add a env variable so that it's exported when linux starts, no matter what desktop system I used, GNOME or KDE, even in pure console mode?
You can setup environmental variables in /etc/profile, /etc/profile.d or the users own config files e.g. ~/.bash_profile. Personally I prefer using /etc/profile.d because that way I don't mess with the stuff in /etc/profile.
Look in the /etc/rc.d/ directory. There should be a rc.local script there which is intended to be the last script executed by the boot process. Export your values from there and, I believe (but I've never done it, having no need), they should be visible to later processes. There are also rc.<n> scripts for each different run level, and the rc.sysinit script that controls the whole boot sequence.
Based on my reading of /etc/rc.d/rc.sysinit, I believe the boot sequence (for scripts) is: /etc/rc.d/rc.sysinit
which calls, in turn /etc/rc.d/rc.<n> # for the specific run level
which, in turn, calls /etc/init.d/* start # for all the services set to be started at the that run level
and then calls /etc/rc.d/rc.local
Edit: Yes, /etc/profile is probably a better choice for your purposes.
Last edited by PTrenholme; 03-11-2006 at 08:03 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.