Bash reads different configuration files depending on how the shell session is started.
- login: A user was authenticated (via user/password).
- non-login: A new shell session was created within an authenticated session. A user was not authenticated.
- interactive: A shell session attached to a terminal session (foreground).
- non-interactive: A shell session not attached to a terminal session (background).
Examples:
- Signing into a machine using SSH: Interactive Login Shell Session
- Running a script: Non-Interactive, Non-Login Shell Session
- reads
/etc/profile, first. then, ~/.bash_profile~/.bash_login~/.profile
/etc/bash.bashrc- system-specific configuration~/.bashrc- user-specific configuration (common location for setting ENV variables)
- Reads the config file defined by
BASH_ENV.
/etc/profile/etc/bash.bashrc/etc/environment- if using nginx