It's a Real Good Idea to leave /etc/profile
alone; i.e., don't ever edit it (it's system-wide).
For customization, system-wide, you can add files to /etc/profile.d
. For personal customization, you can add a ~/.profile
file in your home directory and you can add ~/.bashrc
file as well.
Now, why would you want to do things like that?
Well, the sequence when you log in is execute (in this order)
- /etc/profile.d/<files relevant to the shell program you're using and other executable files there>
At the bottom of /etc/profile
, you'll find this:
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
That's what executes the stuff in /etc/profile.d
. Some of those files are shell-specific (BASH, KornShell, C-Shell, etc.), some are system-wide (setting Java environment and the like).
All that happens once at log in and it happens when you open a terminal window as a "log in shell" which is what you typically want -- you get all the environment settings, aliases you like and all that sort of thing.
Hope this helps some.