GNU/Linux Desktop Survival Guide
by Graham Williams
Bash Startup and Exit
20190903 The command line is orchestrated through the use of a so-called shell which both supports its own set of commands and allows other commands to be utilised within the shell. The Bourne Again SHell (bash) is a widely used and mature shell. It is often the interactive shell (command) that is run when a new terminal is initiated.
When Bash is invoked as an interactive login shell it first reads and executes commands 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. When a login shell exits Bash reads and executes commands from the file ˜/.bash_logout, if it exists.