NAME
zsh - the Z shellOVERVIEW
Because zsh contains many features, the zsh manual has been split into a number of sections:- zsh Zsh overview (this section)
- zshroadmap Informal introduction to the manual
- zshmisc Anything not fitting into the other sections
- zshexpn Zsh command and parameter expansion
- zshparam Zsh parameters
- zshoptions Zsh options
- zshbuiltins Zsh built-in functions
- zshzle Zsh command line editing
- zshcompwid Zsh completion widgets
- zshcompsys Zsh completion system
- zshcompctl Zsh completion control
- zshmodules Zsh loadable modules
- zshcalsys Zsh built-in calendar functions
- zshtcpsys Zsh built-in TCP functions
- zshzftpsys Zsh built-in FTP client
- zshcontrib Additional zsh functions and utilities
- zshall Meta-man page containing all of the above
DESCRIPTION
Zsh is a UNIX command interpreter (shell) usable as an interactive login shell and as a shell script command processor. Of the standard shells, zsh most closely resembles ksh but includes many enhancements. It does not provide compatibility with POSIX or other shells in its default operating mode: see the section `Compatibility' below. Zsh has command line editing, builtin spelling correction, programmable command completion, shell functions (with autoloading), a history mechanism, and a host of other features.AUTHOR
Zsh was originally written by Paul Falstad. Zsh is now maintained by the members of the zsh-workers mailing list <[email protected]>. The development is currently coordinated by Peter Stephenson <[email protected]>. The coordinator can be contacted at <[email protected]>, but matters relating to the code should generally go to the mailing list.AVAILABILITY
Zsh is available from the following HTTP and anonymous FTP site.ftp://ftp.zsh.org/pub/ https://www.zsh.org/pub/The up-to-date source code is available via Git from Sourceforge. See https://sourceforge.net/projects/zsh/ for details. A summary of instructions for the archive can be found at https://zsh.sourceforge.io/.
MAILING LISTS
Zsh has several mailing lists:- <[email protected]>
- Announcements about releases, major changes in the shell and the monthly posting of the Zsh FAQ. (moderated)
- <[email protected]>
- User discussions.
- <[email protected]>
- Hacking, development, bug reports and patches.
- <[email protected]>
- Private mailing list (the general public cannot subscribe to it) for discussing bug reports with security implications, i.e., potential vulnerabilities.
If you find a security problem in zsh itself, please mail this address.
To subscribe or unsubscribe, send mail to the associated administrative address
for the mailing list.
YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED. All
submissions to zsh-announce are automatically forwarded to
zsh-users. All submissions to zsh-users are automatically
forwarded to zsh-workers.
If you have problems subscribing/unsubscribing to any of the mailing lists, send
mail to <[email protected]>.
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above. There is also a hypertext archive
available at https://www.zsh.org/mla/.
THE ZSH FAQ
Zsh has a list of Frequently Asked Questions (FAQ), maintained by Peter Stephenson <[email protected]>. It is regularly posted to the newsgroup comp.unix.shell and the zsh-announce mailing list. The latest version can be found at any of the Zsh FTP sites, or at https://www.zsh.org/FAQ/. The contact address for FAQ-related matters is <[email protected]>.THE ZSH WEB PAGE
Zsh has a web page which is located at https://www.zsh.org/. The contact address for web-related matters is <[email protected]>.THE ZSH USERGUIDE
A userguide is currently in preparation. It is intended to complement the manual, with explanations and hints on issues where the manual can be cabbalistic, hierographic, or downright mystifying (for example, the word `hierographic' does not exist). It can be viewed in its current state at https://zsh.sourceforge.io/Guide/. At the time of writing, chapters dealing with startup files and their contents and the new completion system were essentially complete.INVOCATION
The following flags are interpreted by the shell when invoked to determine where the shell will read commands from:- -c
- Take the first argument as a command to execute, rather than reading commands from a script or standard input. If any further arguments are given, the first one is assigned to $0, rather than being used as a positional parameter.
- -i
- Force shell to be interactive. It is still possible to specify a script to execute.
- -s
- Force shell to read commands from the standard input. If the -s flag is not present and an argument is given, the first argument is taken to be the pathname of a script to execute.
zsh -x -o shwordsplit scr
COMPATIBILITY
Zsh tries to emulate sh or ksh when it is invoked as sh or ksh respectively; more precisely, it looks at the first letter of the name by which it was invoked, excluding any initial ` r' (assumed to stand for `restricted'), and if that is ` b', `s' or `k' it will emulate sh or ksh. Furthermore, if invoked as su (which happens on certain systems when the shell is executed by the su command), the shell will try to find an alternative name from the SHELL environment variable and perform emulation based on that. In sh and ksh compatibility modes the following parameters are not special and not initialized by the shell: ARGC, argv, cdpath, fignore, fpath, HISTCHARS, mailpath, MANPATH, manpath, path, prompt, PROMPT, PROMPT2, PROMPT3, PROMPT4, psvar, status. The usual zsh startup/shutdown scripts are not executed. Login shells source /etc/profile followed by $HOME/.profile. If the ENV environment variable is set on invocation, $ENV is sourced after the profile scripts. The value of ENV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a pathname. Note that the PRIVILEGED option also affects the execution of startup files. The following options are set if the shell is invoked as sh or ksh: NO_BAD_PATTERN, NO_BANG_HIST, NO_BG_NICE, NO_EQUALS, NO_FUNCTION_ARGZERO, GLOB_SUBST, NO_GLOBAL_EXPORT, NO_HUP, INTERACTIVE_COMMENTS, KSH_ARRAYS, NO_MULTIOS, NO_NOMATCH, NO_NOTIFY, POSIX_BUILTINS, NO_PROMPT_PERCENT, RM_STAR_SILENT, SH_FILE_EXPANSION, SH_GLOB, SH_OPTION_LETTERS, SH_WORD_SPLIT. Additionally the BSD_ECHO and IGNORE_BRACES options are set if zsh is invoked as sh. Also, the KSH_OPTION_PRINT, LOCAL_OPTIONS, PROMPT_BANG, PROMPT_SUBST and SINGLE_LINE_ZLE options are set if zsh is invoked as ksh. Please note that, whilst reasonable efforts are taken to address incompatibilities when they arise, zsh does not guarantee complete emulation of other shells, nor POSIX compliance. For more information on the differences between zsh and other shells, please refer to chapter 2 of the shell FAQ, https://www.zsh.org/FAQ/.RESTRICTED SHELL
When the basename of the command used to invoke zsh starts with the letter ` r' or the ` -r' command line option is supplied at invocation, the shell becomes restricted. Emulation mode is determined after stripping the letter ` r' from the invocation name. The following are disabled in restricted mode:- •
- changing directories with the cd builtin
- •
- changing or unsetting the EGID, EUID, GID, HISTFILE, HISTSIZE, IFS, LD_AOUT_LIBRARY_PATH, LD_AOUT_PRELOAD, LD_LIBRARY_PATH, LD_PRELOAD, MODULE_PATH, module_path, PATH, path, SHELL, UID and USERNAME parameters
- •
- specifying command names containing /
- •
- specifying command pathnames using hash
- •
- redirecting output to files
- •
- using the exec builtin command to replace the shell with another command
- •
- using jobs -Z to overwrite the shell process' argument and environment space
- •
- using the ARGV0 parameter to override argv[0] for external commands
- •
- turning off restricted mode with set +r or unsetopt RESTRICTED
STARTUP/SHUTDOWN FILES
Commands are first read from /etc/zsh/zshenv; this cannot be overridden. Subsequent behaviour is modified by the RCS and GLOBAL_RCS options; the former affects all startup files, while the second only affects global startup files (those shown here with an path starting with a /). If one of the options is unset at any point, any subsequent startup file(s) of the corresponding type will not be read. It is also possible for a file in $ZDOTDIR to re-enable GLOBAL_RCS. Both RCS and GLOBAL_RCS are set by default. Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zsh/zprofile 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. When a login shell exits, the files $ZDOTDIR/.zlogout and then /etc/zsh/zlogout are read. This happens with either an explicit exit via the exit or logout commands, or an implicit exit by reading end-of-file from the terminal. However, if the shell terminates due to exec'ing another process, the logout files are not read. These are also affected by the RCS and GLOBAL_RCS options. Note also that the RCS option affects the saving of history files, i.e. if RCS is unset when the shell exits, no history file will be saved. If ZDOTDIR is unset, HOME is used instead. Files listed above as being in /etc may be in another directory, depending on the installation. As /etc/zsh/zshenv is run for all instances of zsh, it is important that it be kept as small as possible. In particular, it is a good idea to put code that does not need to be run for every single shell behind a test of the form ` if [[ -o rcs ]]; then ...' so that it will not be executed when zsh is invoked with the ` -f' option. Any of these files may be pre-compiled with the zcompile builtin command (see zshbuiltins(1)). If a compiled file exists (named for the original file plus the .zwc extension) and it is newer than the original file, the compiled file will be used instead.FILES
- $ZDOTDIR/.zshenv
- $ZDOTDIR/.zprofile
- $ZDOTDIR/.zshrc
- $ZDOTDIR/.zlogin
- $ZDOTDIR/.zlogout
- ${TMPPREFIX}* (default is /tmp/zsh*)
- /etc/zsh/zshenv
- /etc/zsh/zprofile
- /etc/zsh/zshrc
- /etc/zsh/zlogin
- /etc/zsh/zlogout (installation-specific - /etc is the default)
SEE ALSO
sh(1), csh(1), tcsh(1), rc(1), bash(1), ksh(1), zshall(1), zshbuiltins(1), zshcalsys(1), zshcompwid(1), zshcompsys(1), zshcompctl(1), zshcontrib(1), zshexpn(1), zshmisc(1), zshmodules(1), zshoptions(1), zshparam(1), zshroadmap(1), zshtcpsys(1), zshzftpsys(1), zshzle(1) IEEE Standard for information Technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities, IEEE Inc, 1993, ISBN 1-55937-255-9.May 14, 2022 | zsh 5.9 |