Here is the video version, if you prefer it:
I wanted to list out all files related to the user environment and write a short description when each of them is read. By read, I mean “the file is read and its contents are interpreted as commands which are executed.” Why would this be useful? Just so that you have seen the file name at least once, so that when it pops out in some tutorial, you have a vague idea about what it is used for. Of course, Google the name of the file to be sure what it does, but having some general context doesn’t hurt.
Here we go…
Files read by login shells:
.bash_login may not exist in your home directory (they don’t exist in my home directory).
Files read by interactive shells:
As stated in one of the previous articles I wrote, write all of the changes of your environment to
You may wonder what is the difference between the files in the
etc directory and the home (
~) directory. If you modify the files in the
etc directory your changes apply to the entire system (to all users), while if you modify the files in your home directory the changes apply only to your user. (“Diff between /etc/profile and ~/.bash_profile,” n.d.) Hence the suggestion to modify
.bashrc in your home directory, since then it only applies to you.
Also, a word of caution – it is always a good idea to copy the files you are modifying (using
cp for example) so that you can rename them to the original file name if something goes awry with the modified version.
I refer you again to read the superbly written answer here: (“Why is /etc/profile not invoked for non-login shells?,” n.d.)
Hope you learned something useful!
Diff between /etc/profile and ~/.bash_profile. (n.d.). Retrieved February 7, 2020, from https://www.linuxquestions.org/questions/linux-newbie-8/diff-between-etc-profile-and-~-bash_profile-609191/
Why is /etc/profile not invoked for non-login shells? (n.d.). Retrieved February 7, 2020, from https://askubuntu.com/questions/247738/why-is-etc-profile-not-invoked-for-non-login-shells