Shell Customization
Concepts
Shell Startup Files
When Bash starts, it reads configuration files — but which files depend on how the shell was started.
Login vs Non-Login Shell
| Type | When | Example |
|---|---|---|
| Login shell | First shell after authentication | SSH session, TTY login, su - user |
| Non-login shell | Shells opened inside an existing session | Opening a terminal in the desktop, running bash |
Interactive vs Non-Interactive Shell
| Type | When | Example |
|---|---|---|
| Interactive | You type commands at a prompt | Terminal window, SSH session |
| Non-interactive | Runs a script, no prompt | bash script.sh, cron jobs |
Which Files Are Read?
Login shell (interactive):
/etc/profile → ~/.bash_profile OR ~/.bash_login OR ~/.profile (first found)
Non-login shell (interactive):
/etc/bash.bashrc → ~/.bashrc
Non-interactive shell (scripts):
$BASH_ENV (if set)
In practice, on Ubuntu and Debian, ~/.profile sources ~/.bashrc: