Does anyone know what the difference between the /etc/profile and the ~/.bash_profile file is? Which one is executed first?
Asked
Active
Viewed 1,368 times
0
-
1Note that neither one is sourced (they are not executed anyway) when you open a new terminal. – terdon Nov 04 '14 at 15:03
1 Answers
0
When bash is invoked as an interactive login shell, or as a non-inter‐
active shell with the --login option, it first reads and executes com‐
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
This was taken verbatim from man bash
. Man is your friend :)

roadmr
- 34,222
- 9
- 81
- 93