Skip to content

BASH and ZSH initialization sequence

Dmitri edited this page Feb 28, 2021 · 1 revision

BASH initialization

  Interactive login Interactive non-login Script
/etc/profile A    
/etc/bash.bashrc   A  
~/.bashrc   B  
~/.bash_profile B1    
~/.bash_login B2    
~/.profile B3    
BASH_ENV     A
       
       
~/.bash_logout C    

ZSH initialization

  Interactive login Interactive non-login Script
/etc/zshenv A A A
~/.zshenv B B B
/etc/zprofile C    
~/.zprofile D    
/etc/zshrc E C  
~/.zshrc F D  
/etc/zlogin G    
~/.zlogin H    
       
       
~/.zlogout I    
/etc/zlogout J    

Moral:

For bash, put stuff in ~/.bashrc, and make ~/.bash_profile source it.

For zsh, put stuff in ~/.zshrc, which is always executed.

Source

Bash loading flowchart