Sunday 24 September 2017

shell - What is the difference between /etc/environment and /etc/profile?


I understand that the former is loaded prior to the latter, but what is the conceptual difference? Are there any good reasons I should set some variables in one and not in other? Except the fact that /etc/environment seems to exist to set up environment for all processes run by the system, while /etc/profile is for setting up environment used and propagated from the login shell, correct?


Also, on a side note, which program traditionally reads /etc/environment? Is it related to POSIX, or just a convention?



Answer



Extract from The Ubuntu help


/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.


/etc/profile - This file gets executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads.


I think all this is just a convention but not far from a standard (I don't know about RedHat like systems ).


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...