Unix Shell

Unix Shell is a common name for command-line interpreters on Unix-like operating systems.

Login shell

A login shell is the instance of the shell that gets launched after the user logs into the machine. It is defined in the `passwd` file. Note that if one is using a WM, it manages the login shell. Thus, the terminal emulator does not open a login shell, but a non-login interactive shell.

Dotfiles

The configuration files of the shells are usually different from shell to shell, which makes it hard to set environment variables for all shells.

Here's a trimmed down table from wp>Unix shell:

sh

bash

zsh

/etc/sh.shrc

Bourne; if interactive

value of $ENV

not everywhere; if interactive

POSIX mode; if interactive

/etc/profile

if login

if login

sh-compat mode; if login

~/.profile

if login

if no _profile/_login; if login

sh-compat mode; if login

~/.bash_profile

if login

~/.bash_login

if no _profile; if login

~/.bash_logout

if login

~/.bashrc

if not login AND interactive

/etc/zshenv

always

/etc/zprofile

if login

/etc/zshrc

if interactive

/etc/zlogin

if login

/etc/zlogout

if login

~/.zshenv

always

~/.zprofile

if login

~/.zshrc

if interactive

~/.zlogin

if login

Order of launch

Zsh

  1. /etc/zshenv

  2. $ZDOTDIR:-$HOME/.zshenv

  3. /etc/zprofile

  4. $ZDOTDIR:-$HOME/.zprofile

  5. /etc/zshrc

  6. $ZDOTDIR:-$HOME/.zshrc

  7. $ZDOTDIR:-$HOME/.zpreztorc

  8. /etc/zlogin

  9. $ZDOTDIR:-$HOME/.zlogin

  10. $ZDOTDIR:-$HOME/.zlogout

  11. /etc/zlogout

More