All the UNIX shells have several configuration files which they read on startup. The set of configuration files is generally dependent on whether the shell is a login shell, a non-login interactive shell, or a non-interactive shell, and another complication is that non-login shells usually, but not always, inherit their environment from a login shell. Here's a list of the configuration files used by some popular UNIX shells.
- bash
- Login shells: /etc/profile then the first readable file from ~/.bash_profile, ~/.bash_login and ~/.profile
- Non-login interactive shells: ~/.bashrc
- Non-interactive shells: the value of BASH_ENV.
sh
- Login shells: /etc/profile and ~/.profile
- Non-login interactive shells: the value of ENV
- Non-interactive shells: nothing.
tcsh
- Login shells: /etc/csh.cshrc, /etc/csh.login, the first readable file from ~/.tcshrc and ~/.cshrc, ~/.login
- Non-login shells (whether interactive or not): /etc/csh.cshrc, the first readable file from ~/.tcshrc and ~/.cshrc.
csh
- Login shells: /etc/csh.login, ~/.cshrc, ~/.login
- Non-login shells: ~/.cshrc.