Configuration hints for the Z shell (zsh)
How to change the shell
All users get the Z shell (zsh) as their default login shell. Users who would like to work with a different shell (bash in the following example) should append the following lines of code to the end of their ~/.zshrc:
source /usr/local_host/etc/switch_login_shell bash |
You also have to add the line
. /usr/local_host/etc/bashrc
to your ~/.bashrc file in order to activate the modules package, cf. here.
zsh configuration files
zsh has a couple of configuration files. The most important ones are described in the following subsections.
~/.zshrc
This file is read whenever zsh is started as an interactive shell. Therefore you should use it in order to configure the interactive behaviour of your shell, e.g. for
- permanently needed software modules (for example for abaqus: module load abaqus)
- environment variables like EDITOR, PAGER, extensions to MANPATH
- aliases
- shell options (setopt ...)
To switch the command-line mode from 'emacs' (the default) to 'vi' use the following line:
bindkey -v |
~/.zshenv
This file is read for every invocation of zsh and should therefore be as short as possible.
~/.zshenv must not contain any output to stdout, otherwise various programs (e.g. scp) will stop working. Moreover, you must not call any external zsh scripts here. An infinite recursion will occur otherwise. |
At best, you should avoid calling external programs at all and limit yourself to the definition of environment variables only, e.g. extensions to PATH.
~/.zlogout
This file is read whenever a zsh login shell terminates.