Shell Startup Files
Introduction
In this page the used shell startup files will be discussed. Our startpoint is that the environment should be the same for non-interactive, interactive and login shells. This should make it easier and more scalable to run remote commands via SSH or MPI, a.o. used to run network tests.
In the following sections the startup files will be discussed that have been used to define the environment for regular users and to set the shell dependent settings. For each shell a separate section will be used. For clearness reasons some unused startup files will not be mentioned. See the man pages for more details.
[t]csh
At startup the following files will be read by these shells, in this order:
- /etc/csh.cshrc
- /etc/csh.login
- $HOME/.cshrc
- $HOME/.login
The
*cshrc files will be read by all shells while the
*login files are only read by login shells.
There will be assumed that the root user does not use
rcsh as login shell. Therefore, in
/etc/csh.cshrc the user environment and some settings for interactive shells are defined. The file
/etc/csh.login is ignored because it will only be read by login shells.
zsh
At startup the following files will be read by
zsh, in this order:
- /etc/[zsh/]zshenv
- $HOME/.zshenv
- /etc/[zsh/]zprofile
- $HOME/.zprofile
- /etc/[zsh/]zshrc
- $ZDOTDIR/.zshrc
- /etc/[zsh/]zlogin
- $HOME/.zlogin
The sub directory
zsh will only be used by Debian Linux.
The
*zshenv files will be read by all shell types, the files
*zshrc for interactive shells and the
*zprofile and
*zlogin files will be used for interactive shells. This implies that the user environment will be defined in
/etc/[zsh/]zshenv while settings for interactive shells will be defined in
/etc/[zsh/]zshrc. The other files in
/etc will not be used.
For similarity reason asn for the ease of use the same user settings startup files will be used for
zsh and the
bash shell which will be treated in the next section. As the root user also has a
bash login shell the user settings will only be defined for non-root users.
This has been implemented as follows: when the user ID is non-zero the following files suited for
zsh and
bash will be sourced:
- The file /etc/bash_zsh_env.user is sourced by /etc/[zsh/]zshenv to define the user environment settings for all shells.
- The file /etc/bash_zsh_rc.user is sourced by /etc/[zsh/]zshrc to define user shell settings for all interactive shells.
bash
At startup the following files will be read by
bash, in this order:
- For interactive login shells:
- /etc/profile
- $HOME/.bash_profile
- $HOME/.bash_login
- $HOME/.profile
- For interactive non-login shells:
- $HOME/.bashrc
This behaviour has not been appreciated very much. Therefore, the skeleton file for new
bash users,
/etc/skel/.bash_profile, has been modified such that
$HOME/.bashrc will be sourced. And on its turn with the
/etc/skel/.bashrc skeleton file
/etc/bashrc will be sourced.
This makes it possible to define the user environment and shell settings completely in
/etc/bashrc. This has been done by sourcing for non-root users the following files, in this order:
- /etc/bash_zsh_env.user
- /etc/bash_zsh_rc.user
See the
zsh section for more details.
With
bash it is not easy to define an environment for non-interactive shells.
There are no comments on this page. [Add comment]