http://www.acm.uiuc.edu/workshops/zsh/toc.html
The Zsh Startup Files
Like most shells, zsh processes a number of system and user startup files. It is very important to understand the order in which each file is read, and what conditions cause various files to be ignored. Otherwise, you may be entering commands and configurations into your startup files that aren't getting seen or executed by zsh.
The Startup Process
In the below description, zsh looks for user startup files in the user's home directory by default. To make it look in another directory, set the parameterZDOTDIR
to where you'd like zsh to look.
When zsh starts up, the following files are read (in order):
- First, read
/etc/zshenv
If the
RCS
option is unset in this system file, all other startup files are skipped. (Can you say 'B O F H' ? I knew you could.) - Next, read
~/.zshenv
- Next, IF the shell is a login shell, read
/etc/zprofile
, followed by~/.zprofile
- Next, IF the shell is interactive, read
/etc/zshrc
, followed by~/.zshrc
- Finally, if the shell is a login shell, read
/etc/zlogin
, followed by~/.zlogin
Logging Out
When a user logs out,/etc/zlogout
is read, followed by
ZDOTDIR/.zlogout
.