According to the zsh user guide, aliases should be defined in
You may be able to think of some aliases you want to define in your startup files; .zshrc is probably the right place.
It also has a tip for keeping your
I only tend to use aliases in interactive shells, so I define them
from .zshrc, but you may want to use .zshenv if you use aliases more
widely. In fact, to keep my .zshrc neat I save all the aliases in a
separate file called .aliasrc and in .zshrc I have:
if [[ -r ~/.aliasrc ]]; then
which checks if there is a readable file ~/.aliasrc, and if there is,
it runs it in exactly the same way the normal startup files are run.
So, you might want to create a file called
~/.aliasrc and source it (
source) from your
The same source suggests that environmental variables should be in
The easiest place to put these is in .zshenv --- hence it's name. Environment variables will be passed to any programmes run from a shell, so it may be enough to define them in .zlogin or .zprofile: however, any shell started for you non-interactively won't run those, and there are other possible problems if you use a windowing system which is started by a shell other than zsh or which doesn't run a shell start-up file at all --- I had to tweak mine to make it do so. So .zshenv is the safest place; it doesn't take long to define environment variables. Other people will no doubt give you completely contradictory views, but that's people for you.