Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Tag Archives: shell

Startup Sequences of Shells

It is quite confusing if you need to work with multiple, so I make following tables.

zsh

From section STARTUP/SHUTDOWN FILES of man page zsh

Interactive Login Non-Interactive Login Interactive Non-Login Non-Interactive Non-Login
/etc/zshenv
$ZDOTDIR/.zshenv
/etc/zprofile
$ZDOTDIR/.zprofile
/etc/zshrc
$ZDOTDIR/.zshrc
/etc/zshrc
$ZDOTDIR/.zshrc
/etc/zlogin
$ZDOTDIR/.zlogin

bash

From section INVOCATION of man page bash

default

Interactive Login Non-Interactive Login Interactive Non-Login Non-Interactive Non-Login
/etc/profile

Then the first one that is readable amongst:

~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
$BASH_ENV

bash as sh

Interactive Login Non-Interactive Login Interactive Non-Login Non-Interactive Non-Login
/etc/profile
~/.profile
$ENV
$ENV

tcsh

tcsh does not seem care the interactive mode when start up. if environment version has lf, then csh.login and ~/.login will run before csh.cshrc and ~/.tcshrc, respectively.
From section Startup and shutdown of man page tcsh

Login Non-Login
/etc/csh.cshrc
/etc/csh.login
First one that is readable amongst:

~/.tcshrc
~/.cshrc
~/.history
~/.login
~/.cshdirs

^A is shown when typing Ctrl-A zsh

zsh has a nasty/convenient behaviour: it will set vi binding for you if one of environment VISUAL or EDITOR has the command start with vi.

If you don’t like this, run bindkey -e to use the emac mode instead. Put it in your zshrc.