zsh (Z shell) is an interactive login shell that can also be used as a powerful scripting language interpreter. It is similar to bash and the Korn shell, but offers extensive configurability, powerful command-line completion, file globbing, and spelling correction.
See the terminal emulator article for some general usage pointers.
USE flags for app-shells/zsh UNIX Shell similar to the Korn shell
|Use Linux capabilities library to control privilege
|Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
|Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
|Install examples, usually source code
|Add support for sys-libs/gdbm (GNU database libraries)
|Add support for maildir (~/.maildir) style mail spools
|Add support for Perl Compatible Regular Expressions
|!!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
|Enable annotations for accuracy. May slow down runtime slightly. Safe to use even if not currently using dev-debug/valgrind
emerge --ask app-shells/zsh
Emerging zsh has over other shells:enables auto-completion for arguments of commands, which is one of the advantages
emerge --ask app-shells/zsh-completions
To enable auto-completion globally (for most programs), add 'zsh-completion' to the
USE variable in /etc/portage/make.conf
Emergingenables Gentoo specific auto-completion for arguments of Portage and other Gentoo commands:
emerge --ask app-shells/gentoo-zsh-completions
When installing this package be sure to add the following to the respective ~/.zshrc files:
autoload -U compinit promptinit
promptinit; prompt gentoo
To enable a cache for the completions add:
zstyle ':completion::complete:*' use-cache 1
Upon running zsh for the first time as a new user, you will be greeted by a basic configuration dialog. The setup process can be skipped by pressing q. If the setup process is skipped zsh can be setup manually.
Setting zsh as the default shell
To make zsh the default shell for a user, run:
chsh -s /bin/zsh
Note that this method is fine, but trying to use zsh as /bin/sh is strongly discouraged as it has issues in POSIX emulation mode. For example, glibc may fail to build: . If trying to minimise use of Bash on the system, consider Dash for /bin/sh.
zsh's main configuration file is located in each user's home directory at ~/.zshrc. Reload this file in running shells for the changes to take effect:
Reloading via the source command is only necessary when instances of zsh are already in memory after changes are made to the shell's configuration file.
The zsh community created numerous tweaks, the easiest way to acquire them is to install oh-my-zsh framework. It contains handy plugins and eye candy themes, and makes their configuration very easy. However you should always consider the security risk involving running code outside of Gentoo developers jurisdiction.
emerge --ask --depclean --verbose app-shells/zsh
If the Home or End or Del key does not work, try entering keybindings into the user's `~/.zshrc` such as examples in ArchWiki.
The output of a shell can, in some conditions, become corrupt. See the terminal emulator article for instructions to help fix this.
- Zsh/Guide — details installation, configuration, and light usage functionality for zsh.
- Bash — the default shell on Gentoo systems and a popular shell program found on many Linux systems.
- Dash — a small, fast, and POSIX compliant shell.
- Fish — a smart and user-friendly command line shell for OS X, Linux, and the rest of the family.
- Shell — command-line interpreter that offers a text-based interface to users.
- Nushell — a new kind of shell for OS X, Linux, and Windows.