This question already has an answer here:

Does anyone know what the difference between the /etc/profile and the ~/.bash_profile file is? Which one is executed first?

marked as duplicate by terdon, g_p, muru, αғsнιη, Charles Green Nov 5 '14 at 0:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Note that neither one is sourced (they are not executed anyway) when you open a new terminal. – terdon Nov 4 '14 at 15:03
   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 :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.