The Zsh FAQ offers [http://zsh.sourceforge.net/FAQ/zshfaq01.html#l4 more reasons] to use Zsh as your shell.

The Zsh FAQ offers [http://zsh.sourceforge.net/FAQ/zshfaq01.html#l4 more reasons] to use Zsh as your shell.

−

==Installation==

+

== Installation ==

Before starting you may want to see what shell is currently being used:

Before starting you may want to see what shell is currently being used:

Line 20:

Line 20:

$ echo $SHELL

$ echo $SHELL

−

[[pacman|Install]] the {{Pkg|zsh}} package available in the [[Official Repositories|official repositories]].

+

[[pacman|Install]] the {{Pkg|zsh}} package available in the [[official repositories]].

−

===Initial configuration===

+

=== Initial configuration ===

Make sure that Zsh has been installed correctly by running the following in a terminal:

Make sure that Zsh has been installed correctly by running the following in a terminal:

Line 28:

Line 28:

$ zsh

$ zsh

−

You should now see '''zsh-newuser-install''', which will walk you through some basic configuration. If you want to skip this, press {{Ic|q}}.

+

You should now see '''zsh-newuser-install''', which will walk you through some basic configuration. If you want to skip this, press {{Keypress|q}}.

−

===Making Zsh your default shell===

+

=== Making Zsh your default shell ===

−

If the shell is listed in {{ic|/etc/shells}} you can use the {{Ic|chsh}} command to change your default shell without root access. If you installed Zsh from the [[Official Repositories|official repositories]], it should already have an entry in {{ic|/etc/shells}}.

+

If the shell is listed in {{ic|/etc/shells}} you can use the {{ic|chsh}} command to change your default shell without root access. If you installed Zsh from the [[Official Repositories|official repositories]], it should already have an entry in {{ic|/etc/shells}}.

Change the default shell for the current user:

Change the default shell for the current user:

Line 44:

Line 44:

$ echo $SHELL

$ echo $SHELL

−

{{Tip|If you are replacing {{Pkg|bash}}, you may want to move some code from {{ic|~/.bashrc}} to {{ic|~/.zshrc}} (e.g. the prompt and the aliases) and from {{ic|~/.bash_profile}} to {{ic|~/.zprofile}} (e.g. [[Start X at Boot|the code that starts your X Window System]]).}}

+

{{Tip|If you are replacing {{Pkg|bash}}, you may want to move some code from {{ic|~/.bashrc}} to {{ic|~/.zshrc}} (e.g. the prompt and the [[Bash#Aliases|aliases]]) and from {{ic|~/.bash_profile}} to {{ic|~/.zprofile}} (e.g. [[Start X at Boot|the code that starts your X Window System]]).}}

−

==Configuration files==

+

== Configuration files ==

At login, Zsh sources the following files in this order:

At login, Zsh sources the following files in this order:

;{{ic|~/.zshenv}}:This file should contain commands to set the command search path, plus other important environment variables; it should not contain commands that produce output or assume the shell is attached to a tty.

;{{ic|~/.zshenv}}:This file should contain commands to set the command search path, plus other important environment variables; it should not contain commands that produce output or assume the shell is attached to a tty.

Line 58:

Line 58:

{{Note|

{{Note|

*The paths used in Arch's {{Pkg|zsh}} package are different from the default ones used in the man pages.

*The paths used in Arch's {{Pkg|zsh}} package are different from the default ones used in the man pages.

−

*{{Ic|$ZDOTDIR}} defaults to {{Ic|$HOME}}

+

*{{ic|$ZDOTDIR}} defaults to {{ic|$HOME}}

*{{ic|/etc/profile}} is not a part of the regular list of startup files run for Zsh, but is sourced from {{ic|/etc/zsh/zprofile}} in the {{Pkg|zsh}} package. Users should take note that {{ic|/etc/profile}} sets the {{ic|$PATH}} variable which will overwrite any {{ic|$PATH}} variable set in {{ic|~/.zshenv}}. To prevent this, either replace the {{ic|/etc/zsh/zprofile}} file with your own, or set your {{ic|$PATH}} variable from {{ic|~/.zshrc}}.

*{{ic|/etc/profile}} is not a part of the regular list of startup files run for Zsh, but is sourced from {{ic|/etc/zsh/zprofile}} in the {{Pkg|zsh}} package. Users should take note that {{ic|/etc/profile}} sets the {{ic|$PATH}} variable which will overwrite any {{ic|$PATH}} variable set in {{ic|~/.zshenv}}. To prevent this, either replace the {{ic|/etc/zsh/zprofile}} file with your own, or set your {{ic|$PATH}} variable from {{ic|~/.zshrc}}.

}}

}}

−

==~/.zshrc configuration==

+

== ~/.zshrc configuration ==

Although Zsh is usable out of the box, it is almost certainly not set up the way you would like to use it, but due to the sheer amount of customisation available in Zsh, configuring Zsh can be a daunting and time-consuming experience.

Although Zsh is usable out of the box, it is almost certainly not set up the way you would like to use it, but due to the sheer amount of customisation available in Zsh, configuring Zsh can be a daunting and time-consuming experience.

Line 70:

Line 70:

$ source ~/.zshrc

$ source ~/.zshrc

−

===Simple .zshrc===

+

=== Simple .zshrc ===

Here is a simple {{ic|.zshrc}}, that should be sufficient to get you started:

Here is a simple {{ic|.zshrc}}, that should be sufficient to get you started:

Line 82:

Line 82:

prompt walters}}

prompt walters}}

−

=== Command Completion ===

+

=== Command completion ===

Perhaps the most compelling feature of Zsh is its advanced autocompletion abilities. At the very least, you will want to enable autocompletion in your {{ic|.zshrc}}. To enable autocompletion, add the following to:

Perhaps the most compelling feature of Zsh is its advanced autocompletion abilities. At the very least, you will want to enable autocompletion in your {{ic|.zshrc}}. To enable autocompletion, add the following to:

Line 107:

Line 107:

=== The "command not found" hook ===

=== The "command not found" hook ===

The [[pkgfile]] package includes a "command not found" hook that will automatically search the [[official repositories]] when you enter an unrecognized command. Then it will display something like this:

The [[pkgfile]] package includes a "command not found" hook that will automatically search the [[official repositories]] when you enter an unrecognized command. Then it will display something like this:

Zsh does not use readline, instead it uses its own and more powerful zle. It does not read {{ic|/etc/inputrc}} or {{ic|~/.inputrc}}.

Zsh does not use readline, instead it uses its own and more powerful zle. It does not read {{ic|/etc/inputrc}} or {{ic|~/.inputrc}}.

zle has an [[emacs]] mode and a [[vi]] mode. By default, it tries to guess whether you want emacs or vi keys from the {{ic|$EDITOR}} environment variable. If it is empty, it will default to emacs. You can change this with {{ic|bindkey -v}} or {{ic|bindkey -e}}.

zle has an [[emacs]] mode and a [[vi]] mode. By default, it tries to guess whether you want emacs or vi keys from the {{ic|$EDITOR}} environment variable. If it is empty, it will default to emacs. You can change this with {{ic|bindkey -v}} or {{ic|bindkey -e}}.

Line 174:

Line 175:

}}

}}

−

{{Note|To get the proper sequences for certain key combinations, start {{Ic|cat}} or {{Ic|read}} without any parameters and press them; they should then be printed in the terminal. Both can be closed again via {{Keypress|Ctrl+C}}.}}

+

{{Note|To get the proper sequences for certain key combinations, start {{ic|cat}} or {{ic|read}} without any parameters and press them; they should then be printed in the terminal. Both can be closed again via {{Keypress|Ctrl+c}}.}}

+

+

==== Bind key to ncurses application ====

+

You can bind a ncurses application to a keystoke, but it will not accept interaction. Use {{ic|BUFFER}} variable to make it work. The following example lets you open ncmpcpp using {{Keypress|Alt+\}}:

+

{{hc|~/.zshrc|2=

+

ncmpcppShow() { BUFFER="ncmpcpp"; zle accept-line; }

+

zle -N ncmpcppShow

+

bindkey '^[\' ncmpcppShow

+

}}

−

===History search===

+

=== History search ===

You can add these lines to your .zshrc

You can add these lines to your .zshrc

Line 186:

Line 195:

Doing this, only past commands beginning with the current input would have been shown.

Doing this, only past commands beginning with the current input would have been shown.

−

===Prompts===

+

=== Prompts ===

There is a quick and easy way to set up a colored prompt in Zsh. Make sure that prompt is set to autoload in your {{ic|.zshrc}}. This can be done by adding these lines to:

There is a quick and easy way to set up a colored prompt in Zsh. Make sure that prompt is set to autoload in your {{ic|.zshrc}}. This can be done by adding these lines to:

Line 203:

Line 212:

$ prompt walters

$ prompt walters

−

===Customizing your prompt===

+

=== Customizing your prompt ===

−

In case you are dissatisfied with the prompts mentioned above(or want to expand their usefulness), zsh offers the possibility to build your own custom prompt. Zsh supports a left- and right-sided prompt additional to the single, left-sided prompt that is common to all shells. You can customize it by using {{ic|1=PROMPT=}} with the following variables:

+

In case you are dissatisfied with the prompts mentioned above(or want to expand their usefulness), Zsh offers the possibility to build your own custom prompt. Zsh supports a left- and right-sided prompt additional to the single, left-sided prompt that is common to all shells. You can customize it by using {{ic|1=PROMPT=}} with the following variables:

−

====Prompt variables====

+

==== Prompt variables ====

−

=====General=====

+

===== General =====

; %n : The username

; %n : The username

; %m : The computer's hostname(truncated to the first period)

; %m : The computer's hostname(truncated to the first period)

Line 214:

Line 223:

; %l : The current tty

; %l : The current tty

; %? : The return code of the last-run application.

; %? : The return code of the last-run application.

−

; %# : The prompt based on user privileges ({{Ic|#}} for root and {{Ic|%}} for the rest)

+

; %# : The prompt based on user privileges ({{ic|#}} for root and {{ic|%}} for the rest)

−

=====Times=====

+

===== Times =====

; %T : System time(HH:MM)

; %T : System time(HH:MM)

; %* : System time(HH:MM:SS)

; %* : System time(HH:MM:SS)

; %D : System date(YY-MM-DD)

; %D : System date(YY-MM-DD)

−

=====Directories=====

+

===== Directories =====

; %~ : The current working directory. If you are in you are in your {{ic|$HOME}}, this will be replaced by {{ic|~}}.

; %~ : The current working directory. If you are in you are in your {{ic|$HOME}}, this will be replaced by {{ic|~}}.

; %d : The current working directory.

; %d : The current working directory.

−

For the options mentioned above: You can prefix an integer to show only certain parts of your working path. If you entered {{Ic|%1d}} and found yourself in {{Ic|/usr/bin}} it would show {{Ic|bin}}. This can also be done with negative integers:

+

For the options mentioned above: You can prefix an integer to show only certain parts of your working path. If you entered {{ic|%1d}} and found yourself in {{ic|/usr/bin}} it would show {{ic|bin}}. This can also be done with negative integers:

−

{{Ic|%-1d}} using the same directory as above would show {{Ic|/}}.

+

{{ic|%-1d}} using the same directory as above would show {{ic|/}}.

−

=====Formatting=====

+

===== Formatting =====

; %U [...] %u : Begin and end underlined print

; %U [...] %u : Begin and end underlined print

; %B [...] %b : Begin and end bold print

; %B [...] %b : Begin and end bold print

Line 235:

Line 244:

:As such, not to use it can have some weird effects on the margins and indentation of the prompt.

:As such, not to use it can have some weird effects on the margins and indentation of the prompt.

−

=====Colors=====

+

===== Colors =====

−

Zsh has a different approach to setting colors on the terminal than the one depicted [https://wiki.archlinux.org/index.php/Color_Bash_Prompt here]. First you write before {{ic|1=PROMPT=}} in your {{Ic|.zshrc}}:

+

Zsh has a different approach to setting colors on the terminal than the one depicted [https://wiki.archlinux.org/index.php/Color_Bash_Prompt here]. First you write before {{ic|1=PROMPT=}} in your {{ic|.zshrc}}:

autoload -U colors && colors

autoload -U colors && colors

Line 244:

Line 253:

; $fg_bold[color]: will set the bold text color

; $fg_bold[color]: will set the bold text color

; $reset_color : will reset the text color to white

; $reset_color : will reset the text color to white

−

It is useful to put these color commands inside {{Ic|%{ [...] %} }}, so the shell knows there is no output from these sequences and the cursor hasn't moved.

+

It is useful to put these color commands inside {{ic|%{ [...] %} }}, so the shell knows there is no output from these sequences and the cursor hasn't moved.

;Possible color values

;Possible color values

Line 260:

Line 269:

Note that bold text doesn't necessarily use the same colors as normal text. For example, $fg['yellow'] looks brown or a very dark yellow, while $fg_no_bold['yellow'] looks like bright or regular yellow.

Note that bold text doesn't necessarily use the same colors as normal text. For example, $fg['yellow'] looks brown or a very dark yellow, while $fg_no_bold['yellow'] looks like bright or regular yellow.

* An Arch package named [https://www.archlinux.org/packages/extra/any/grml-zsh-config/ grml-zsh-config] comes from http://grml.org/zsh and provides a zshrc file that includes many tweaks for your zshell.

+

* An Arch package named [https://www.archlinux.org/packages/extra/any/grml-zsh-config/ grml-zsh-config] comes from http://grml.org/zsh and provides a zshrc file that includes many tweaks for your Zshell.

* https://github.com/slashbeast/things/blob/master/configs/DOTzshrc - zshrc with multiple features, be sure to check out comments into it. Notable features: confirm function to ensure that user wnat to run poweroff, reboot or hibernate, support for GIT in prompt (done without vcsinfo), tab completion with menu, printing current executed command into window's title bar and more.

* https://github.com/slashbeast/things/blob/master/configs/DOTzshrc - zshrc with multiple features, be sure to check out comments into it. Notable features: confirm function to ensure that user wnat to run poweroff, reboot or hibernate, support for GIT in prompt (done without vcsinfo), tab completion with menu, printing current executed command into window's title bar and more.

−

==Global configuration==

+

== Global configuration ==

−

Occasionally you might want to have some settings applied globally to all zsh users. The zsh wiki tells us that there are some global configuration files, for example {{ic|/etc/zshrc}}. This however is slightly different on ArchLinux, since it has been compiled with flags specifically to target {{ic|/etc/zsh/}} instead.

+

Occasionally you might want to have some settings applied globally to all Zsh users. The Zsh wiki tells us that there are some global configuration files, for example {{ic|/etc/zshrc}}. This however is slightly different on ArchLinux, since it has been compiled with flags specifically to target {{ic|/etc/zsh/}} instead.

So, for global configuration use {{ic|/etc/zsh/zshrc}}, not {{ic|/etc/zshrc}}. The same goes for {{ic|/etc/zsh/zshenv}}, {{ic|/etc/zsh/zlogin}} and {{ic|/etc/zsh/zlogout}}. Note that these files are not installed by default, so you need to create them yourself if you want to use them.

So, for global configuration use {{ic|/etc/zsh/zshrc}}, not {{ic|/etc/zshrc}}. The same goes for {{ic|/etc/zsh/zshenv}}, {{ic|/etc/zsh/zlogin}} and {{ic|/etc/zsh/zlogout}}. Note that these files are not installed by default, so you need to create them yourself if you want to use them.

Line 285:

Line 294:

The only exception is zprofile, use {{ic|/etc/profile}} instead.

The only exception is zprofile, use {{ic|/etc/profile}} instead.

−

===Autostarting applications===

+

=== Autostarting applications ===

Zsh always executes {{ic|/etc/zsh/zshenv}} and {{ic|$ZDOTDIR/.zshenv}} so do not bloat these files.

Zsh always executes {{ic|/etc/zsh/zshenv}} and {{ic|$ZDOTDIR/.zshenv}} so do not bloat these files.

If the shell is a login shell, commands are read from {{ic|/etc/profile}} and then {{ic|$ZDOTDIR/.zprofile}}. Then, if the shell is interactive, commands are read from {{ic|/etc/zsh/zshrc}} and then {{ic|$ZDOTDIR/.zshrc}}. Finally, if the shell is a login shell, {{ic|/etc/zsh/zlogin}} and {{ic|$ZDOTDIR/.zlogin}} are read.

If the shell is a login shell, commands are read from {{ic|/etc/profile}} and then {{ic|$ZDOTDIR/.zprofile}}. Then, if the shell is interactive, commands are read from {{ic|/etc/zsh/zshrc}} and then {{ic|$ZDOTDIR/.zshrc}}. Finally, if the shell is a login shell, {{ic|/etc/zsh/zlogin}} and {{ic|$ZDOTDIR/.zlogin}} are read.

−

==Uninstallation==

+

== Uninstallation ==

If you decide that Zsh is not the shell for you and you want to return to Bash, you must first change the default shell, before removing the Zsh package.

If you decide that Zsh is not the shell for you and you want to return to Bash, you must first change the default shell, before removing the Zsh package.

−

{{Warning| Failure to follow the below procedures will result in all kinds of problems.}}

+

{{Warning|Failure to follow the below procedures will result in all kinds of problems.}}

Paste the following command in terminal as root:

Paste the following command in terminal as root:

Line 303:

Line 312:

If you did not follow the above, you can still change the default shell back to Bash by editing {{ic|/etc/passwd}} as root.

If you did not follow the above, you can still change the default shell back to Bash by editing {{ic|/etc/passwd}} as root.

−

{{Warning| It is '''strongly''' recommended to use vipw when editing user information as it prevents badly formatted entries.}}

+

{{Warning|It is '''strongly''' recommended to use vipw when editing user information as it prevents badly formatted entries.}}

*[http://my.opera.com/blackbelt_jones/blog/2007/06/05/zsh-prompt-configuration-issue-solved Setting up the zsh prompt]

+

*[http://my.opera.com/blackbelt_jones/blog/2007/06/05/zsh-prompt-configuration-issue-solved Setting up the Zsh prompt]

*'''IRC channel''': #zsh at irc.freenode.org

*'''IRC channel''': #zsh at irc.freenode.org

Revision as of 18:40, 18 May 2013

zh-CN:ZshZsh is a powerful shell that operates as both an interactive shell and as a scripting language interpreter. While being compatible with Bash (not by default, only if you issue "emulate sh"), it offers many advantages such as:

Installation

Initial configuration

Make sure that Zsh has been installed correctly by running the following in a terminal:

$ zsh

You should now see zsh-newuser-install, which will walk you through some basic configuration. If you want to skip this, press Template:Keypress.

Making Zsh your default shell

If the shell is listed in /etc/shells you can use the chsh command to change your default shell without root access. If you installed Zsh from the official repositories, it should already have an entry in /etc/shells.

Change the default shell for the current user:

$ chsh -s $(which zsh)

Note: You have to log out and log back in, in order to start using Zsh as your default shell.

After logging back in, you should notice Zsh's prompt, which by default looks different from Bash's. However you can verify that Zsh is the current shell by issuing:

Configuration files

At login, Zsh sources the following files in this order:

~/.zshenv

This file should contain commands to set the command search path, plus other important environment variables; it should not contain commands that produce output or assume the shell is attached to a tty.

/etc/profile

This file is sourced by all Bourne-compatible shells upon login: it sets up an environment upon login and application-specific (/etc/profile.d/*.sh) settings.

~/.zprofile

This file is generally used for automatic execution of user's scripts.

~/.zshrc

This is Zsh's main configuration file.

~/.zlogin

This file is generally used for automatic execution of user's scripts.

At logout it sources ~/.zlogout, which is used for automatic execution of user's scripts.

Note:

The paths used in Arch's zsh package are different from the default ones used in the man pages.

$ZDOTDIR defaults to $HOME

/etc/profile is not a part of the regular list of startup files run for Zsh, but is sourced from /etc/zsh/zprofile in the zsh package. Users should take note that /etc/profile sets the $PATH variable which will overwrite any $PATH variable set in ~/.zshenv. To prevent this, either replace the /etc/zsh/zprofile file with your own, or set your $PATH variable from ~/.zshrc.

~/.zshrc configuration

Although Zsh is usable out of the box, it is almost certainly not set up the way you would like to use it, but due to the sheer amount of customisation available in Zsh, configuring Zsh can be a daunting and time-consuming experience.

Included below is a sample configuration file, it provides a decent set of default options as well as giving examples of many ways that Zsh can be customised. In order to use this configuration save it as a file named .zshrc. You can then apply the changes without needing to logout and then back in by running:

$ source ~/.zshrc

Simple .zshrc

Here is a simple .zshrc, that should be sufficient to get you started:

~/.zshrc

autoload -U compinit promptinit
compinit
promptinit
# This will set the default prompt to the walters theme
prompt walters

Command completion

Perhaps the most compelling feature of Zsh is its advanced autocompletion abilities. At the very least, you will want to enable autocompletion in your .zshrc. To enable autocompletion, add the following to:

~/.zshrc

autoload -U compinit
compinit

The above configuration includes ssh/scp/sftp hostnames completion but in order for this feature to work you will need to prevent ssh from hashing hosts names in ~/.ssh/known_hosts.

Warning: This makes your computer vulnerable to "Island-hopping" attacks. In that intention, comment the following line or set the value to no:

/etc/ssh/ssh_config

#HashKnownHosts yes

And move your ~/.ssh/known_hosts somewhere else so that ssh creates a new one with un-hashed hostnames (previously known hosts will thus be lost).

For autocompletion with an arrow-key driven interface, add the following to:

~/.zshrc

zstyle ':completion:*' menu select

To activate the menu, press tab twice.

For autocompletion of command line switches for aliases, add the following to:

~/.zshrc

setopt completealiases

The "command not found" hook

The pkgfile package includes a "command not found" hook that will automatically search the official repositories when you enter an unrecognized command. Then it will display something like this:

$ abiword

abiword may be found in the following packages:
extra/abiword 2.8.6-7 usr/bin/abiword

An alternative "command not found" hook is also provided by the AUR package command-not-found, which will generate an output like the following:

Key bindings

Zsh does not use readline, instead it uses its own and more powerful zle. It does not read /etc/inputrc or ~/.inputrc.
zle has an emacs mode and a vi mode. By default, it tries to guess whether you want emacs or vi keys from the $EDITOR environment variable. If it is empty, it will default to emacs. You can change this with bindkey -v or bindkey -e.

Note: To get the proper sequences for certain key combinations, start cat or read without any parameters and press them; they should then be printed in the terminal. Both can be closed again via Template:Keypress.

Bind key to ncurses application

You can bind a ncurses application to a keystoke, but it will not accept interaction. Use BUFFER variable to make it work. The following example lets you open ncmpcpp using Template:Keypress:

Doing this, only past commands beginning with the current input would have been shown.

Prompts

There is a quick and easy way to set up a colored prompt in Zsh. Make sure that prompt is set to autoload in your .zshrc. This can be done by adding these lines to:

~/.zshrc

autoload -U promptinit
promptinit

You can now see available prompts by running the command:

$ prompt -l

To try one of the commands that is listed, use the command prompt followed by the name of the prompt you like. For example, to use the walters prompt, you would enter:

$ prompt walters

Customizing your prompt

In case you are dissatisfied with the prompts mentioned above(or want to expand their usefulness), Zsh offers the possibility to build your own custom prompt. Zsh supports a left- and right-sided prompt additional to the single, left-sided prompt that is common to all shells. You can customize it by using PROMPT= with the following variables:

Prompt variables

General

%n

The username

%m

The computer's hostname(truncated to the first period)

%M

The computer's hostname

%l

The current tty

%?

The return code of the last-run application.

%#

The prompt based on user privileges (# for root and % for the rest)

Times

%T

System time(HH:MM)

%*

System time(HH:MM:SS)

%D

System date(YY-MM-DD)

Directories

%~

The current working directory. If you are in you are in your $HOME, this will be replaced by ~.

%d

The current working directory.

For the options mentioned above: You can prefix an integer to show only certain parts of your working path. If you entered %1d and found yourself in /usr/bin it would show bin. This can also be done with negative integers:
%-1d using the same directory as above would show /.

Formatting

%U [...] %u

Begin and end underlined print

%B [...] %b

Begin and end bold print

%{ [...] %}

Begin and enter area that will not be printed. Useful for setting colors.

In fact, this tag forces Zsh to ignore anything inside them when making indents for the prompt as well.

As such, not to use it can have some weird effects on the margins and indentation of the prompt.

Colors

Zsh has a different approach to setting colors on the terminal than the one depicted here. First you write before PROMPT= in your .zshrc:

autoload -U colors && colors

Following commands would now produce the color escape sequence needed to set the requested color when the prompt is printed:

$fg[color]

will set the text color (red, green, blue, etc. - defaults to bold)

$fg_no_bold[color]

will set the non-bold text color

$fg_bold[color]

will set the bold text color

$reset_color

will reset the text color to white

It is useful to put these color commands inside %{ [...] %} , so the shell knows there is no output from these sequences and the cursor hasn't moved.

Possible color values

black

red

green

yellow

blue

magenta

cyan

white

Note that bold text doesn't necessarily use the same colors as normal text. For example, $fg['yellow'] looks brown or a very dark yellow, while $fg_no_bold['yellow'] looks like bright or regular yellow.

https://github.com/slashbeast/things/blob/master/configs/DOTzshrc - zshrc with multiple features, be sure to check out comments into it. Notable features: confirm function to ensure that user wnat to run poweroff, reboot or hibernate, support for GIT in prompt (done without vcsinfo), tab completion with menu, printing current executed command into window's title bar and more.

Global configuration

Occasionally you might want to have some settings applied globally to all Zsh users. The Zsh wiki tells us that there are some global configuration files, for example /etc/zshrc. This however is slightly different on ArchLinux, since it has been compiled with flags specifically to target /etc/zsh/ instead.

So, for global configuration use /etc/zsh/zshrc, not /etc/zshrc. The same goes for /etc/zsh/zshenv, /etc/zsh/zlogin and /etc/zsh/zlogout. Note that these files are not installed by default, so you need to create them yourself if you want to use them.

The only exception is zprofile, use /etc/profile instead.

Autostarting applications

Zsh always executes /etc/zsh/zshenv and $ZDOTDIR/.zshenv so do not bloat these files.

If the shell is a login shell, commands are read from /etc/profile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zsh/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zsh/zlogin and $ZDOTDIR/.zlogin are read.

Uninstallation

If you decide that Zsh is not the shell for you and you want to return to Bash, you must first change the default shell, before removing the Zsh package.

Warning: Failure to follow the below procedures will result in all kinds of problems.

Paste the following command in terminal as root:

# chsh -s /bin/bash user

Use it for every user using Zsh.

Now you can safely remove the Zsh package.

If you did not follow the above, you can still change the default shell back to Bash by editing /etc/passwd as root.

Warning: It is strongly recommended to use vipw when editing user information as it prevents badly formatted entries.