What is /etc/profile used for?#

If you have been using Linux for a while you are probably familiar with the .profile or .bash_profile files in your home directory. These files are used to set environmental items for a users shell.

Items such as umask, and variables such as PS1 or PATH are appropriate to set in .profile or .bash_profile.

The /etc/profile file is not very different however it is used to set system wide environmental variables on ALL users shells. The variables are sometimes the same ones that are in the .bash_profile, however this file is used to set an initial PATH or PS1 for all shell users of the system.


In addition to the setting environmental items the /etc/profile will execute the scripts within /etc/profile.d/*.sh. If you plan on setting your own system wide environmental variables it is recommended to place your configuration in a shell script within /etc/profile.d.

More Information#

There might be more information for this subject on one of the following: