This question comes up quite often:
“What do all those config files do? When are they run?”
Okay, it's described in the manpage (/STARTUP FILES) and in the FAQ (q.3.2), but I guess, I'll quickly put a page in the wiki, as well, just to make sure people can find the information.
Good question. Usually, zsh's global config files are located in /etc (eg. /etc/zshrc) and your personal configs are located in your home directory (eg. /home/ft/.zshrc).
BUT zsh is very flexible, so the location of the global config files (via compile time options), as well as the personal config files (via $ZDOTDIR), may be changed.
Checking $ZDOTDIR is easy (and left as an exercise for the reader). Note, if $ZDOTDIR isn't set, $HOME is the location for per-user-config files.
Checking for the global location takes a little trick:
zsh% strings =zsh | grep zshrc /etc/zsh/zshrc .zshrc
See? That's the output on a debian System, where the global configs are put in /etc/zsh/.
There are several types of config files for zsh. For each type there are two files: one global and one per-user file. The global file is read before the per-user one.
If you do not know what an interactive shell or a login shell is, please read chapter 2 of the users guide (at least 2.1). I know people are impatient, so a here's quick way of testing, if you are in a login shell:
if [[ -o login ]] ; then echo login shell else echo _no_ login shell fi
Yes, you can test for interactive shells in the same way (but isn't that rather obvious?).
Here's a quick listing (first name is the global config file; the 2nd [the one with the dot] is corresponding the per-user config file). Note, that this listing is in chronological order.
zshenv / / .zshenv
zprofile / / .zprofile
zshrc / / .zshrc
zlogin / / .zlogin
These are similar to Startup Files, so I'll add them here.
Shutdown Files are run, when a login shell exits. The available files are: .zlogout and zlogout (Note, that for Shutdown files, the order is different to Startup files: first the per-user file is read, then the global one).