.zshrc

From Linux Bash Shell Scripting Tutorial Wiki
Jump to navigation Jump to search

The .zshrc file is used by zsh as a startup file on Linux and Unix-like systems.

What is a .zshrc file?

If the shell is interactive (zsh), commands are read from /etc/zsh/zshrc and then $ZDOTDIR/.zshrc or ~/.zshrc.

How do I know if its zsh or bash?

Try using the following commands[1]:

echo "$SHELL" # may not work on zsh
ps -p $$ 
readlink /proc/$$/exe

Syntax

The syntax is simple:

option=value
variable=value
export VAR=foo

Use the man command to read all zsh options:

man zshoptions

Examples

Use the cat command or more command/less command to view the current config:

cat .zshrc
cat ~/.zshrc
Linux zsh startup file .zshrc example
Linux zsh startup file .zshrc example

Notes