Wednesday, April 8, 2020

BASH startup file loading order

The loading order of Bash startup files is first dependent on the type of shell that Bash think it is in.
login shell is when the user logs in from tty (not through a GUI) or logs in remotely (e.g. through ssh).
non-login shell is started in other ways such as gnome-terminal which is started by Gnome (it is a login shell that launched Gnome).
Note: The exception is OSX's which is treated as a login shell.
For non-login shells (e.g. gnome-terminal) the order is:

For login-shells (including the order is: /etc/profile and then first of:

Followed by the first of the following: