(Up-to-date source of this post.)
When bash
is started it runs a series of scripts to prepare the environment
for user. These scripts, for example, set the environment variables, create
command aliases, run programs.
Login shell | Non-login shell | |
---|---|---|
Global config | /etc/profile, /etc/profile.d/ | /etc/bash.bashrc, /etc/bash/bashrc, /etc/bashrc |
User config | ~/.bash_profile, ~/.bash_login, ~/.profile | ~/.bashrc |
- login shell -- a shell started by the
login
program or a remote login server such as SSH; place for variables likePATH
,PS1
and startup programs likeumask
- non-login shell -- not started by the
login
program, run on every instance (ex. shell inside an X-based terminal); place for aliases and functions
Creating a symlink between ~/.bashrc
and ~/.bash_profile
will ensure that the same startup scripts run for both login and non-login sessions. Debian's ~/.profile
sources ~/.bashrc
, which has the same effect.
More
- Prostredie shellu (in Slovak)
- my dot-files
- ULSAH p. 189