You are located in service: RWTH High Performance Computing (Linux)

Configuration hints for the Z shell (zsh)

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 system, cf. here.

zsh configuration files

zsh has a couple of configuration files. The most important ones are described in the following subsections.


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

  • 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


This file is read for every invocation of zsh and should therefore be as short as possible.

Please Note: ~/.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.


This file is read whenever a zsh login shell terminates.

last changed on 03/27/2023

How did this content help you?

Creative Commons Lizenzvertrag
This work is licensed under a Creative Commons Attribution - Share Alike 3.0 Germany License