NAME
zsh - the Z shell
OOVVEERRVVIIEEWWBecause zsh contains many features, the zsh manual has been split into
a number of sections:zsh Zsh overview (this section)
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
zshzftpsys Zsh built-in FTP client
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 standardshells, zsh most closely resembles kksshh but includes many enhancements.
Zsh has command line editing, builtin spelling correction, programmablecommand completion, shell functions (with autoloading), a history mech-
anism, 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 <
eerrss@@ssuunnssiittee..ddkk>>. The development is currently coordinated by Peter Stephenson <
>. The coordinator can be contacted at < nnaattoorr@@zzsshh..oorrgg>>, but matters relating to the code should generally go to the mailing list. AVAILABILITY Zsh is available from the following anonymous FTP sites. These mirror sites are kept frequently up to date. The sites marked with (H) may be mirroring ffttpp..ccss..eellttee..hhuu instead of the primary site. Primary site ffttpp::////ffttpp..zzsshh..oorrgg//ppuubb//zzsshh// hhttttpp::////wwwwww..zzsshh..oorrgg//ppuubb//zzsshh// Australia ffttpp::////ffttpp..zzsshh..oorrgg//ppuubb//zzsshh// hhttttpp::////wwwwww..zzsshh..oorrgg//ppuubb//zzsshh// Denmark ffttpp::////ssuunnssiittee..ddkk//ppuubb//uunniixx//sshheellllss//zzsshh// Finland ffttpp::////ffttpp..ffuunneett..ffii//ppuubb//uunniixx//sshheellllss//zzsshh// Germany ffttpp::////ffttpp..ffuu-bbeerrlliinn..ddee//ppuubb//uunniixx//sshheellllss//zzsshh// (H)
ffttpp::////ffttpp..ggmmdd..ddee//ppaacckkaaggeess//zzsshh//ffttpp::////ffttpp..uunnii-ttrriieerr..ddee//ppuubb//uunniixx//sshheellll//zzsshh//
Hungary ffttpp::////ffttpp..ccss..eellttee..hhuu//ppuubb//zzsshh// hhttttpp::////wwwwww..ccss..eellttee..hhuu//ppuubb//zzsshh// ffttpp::////ffttpp..kkffkkii..hhuu//ppuubb//ppaacckkaaggeess//zzsshh// Israel ffttpp::////ffttpp..mmaatthh..tteecchhnniioonn..aacc..iill//ppuubb//zzsshh// hhttttpp::////wwwwww..mmaatthh..tteecchhnniioonn..aacc..iill//ppuubb//zzsshh// Japan ffttpp::////ffttpp..wwiinn..nnee..jjpp//ppuubb//sshheellll//zzsshh// ffttpp::////ffttpp..aayyaammuurraa..oorrgg//ppuubb//zzsshh// Korea ffttpp::////lliinnuuxx..ssaarraanngg..nneett//mmiirrrroorr//ssyysstteemm//sshheellll//zzsshh// Netherlands ffttpp::////ffttpp..ddeemmoonn..nnll//ppuubb//mmiirrrroorrss//zzsshh// Norway ffttpp::////ffttpp..uuiitt..nnoo//ppuubb//uunniixx//sshheellllss//zzsshh// Poland ffttpp::////ssuunnssiittee..iiccmm..eedduu..ppll//ppuubb//uunniixx//sshheellllss//zzsshh// Romania ffttpp::////ffttpp..rrooeedduu..nneett//ppuubb//mmiirrrroorrss//ffttpp..zzsshh..oorrgg//ppuubb//zzsshh// ffttpp::////ffttpp..kkaappppaa..rroo//ppuubb//mmiirrrroorrss//ffttpp..zzsshh..oorrgg//ppuubb//zzsshh// Slovenia ffttpp::////ffttpp..ssiiooll..nneett//mmiirrrroorrss//zzsshh// Sweden ffttpp::////ffttpp..llyyssaattoorr..lliiuu..ssee//ppuubb//uunniixx//zzsshh// UK ffttpp::////ffttpp..nneett..lluutt..aacc..uukk//zzsshh// ffttpp::////ssuunnssiittee..oorrgg..uukk//ppaacckkaaggeess//zzsshh// USA ffttpp::////uuiiaarrcchhiivvee..uuiiuucc..eedduu//mmiirrrroorrss//ffttpp//ffttpp..zzsshh..oorrgg//ppuubb// ffttpp::////ffttpp..rrggee..ccoomm//ppuubb//sshheellllss//zzsshh// hhttttpp::////zzsshh..ddiissiilllluussiioonn..oorrgg// hhttttpp::////ffooaadd..oorrgg//zzsshh//The up-to-date source code is available via anonymous CVS from Source-
forge. See hhttttpp::////ssoouurrcceeffoorrggee..nneett//pprroojjeeccttss//zzsshh// for details. MMAAIILLIINNGG LLIISSTTSS Zsh has 3 mailing lists:<
Announcements about releases, major changes in the shell and the monthly posting of the Zsh FAQ. (moderated)> <
User discussions.> <
Hacking, development, bug reports and patches. 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 zzsshh-aannnnoouunnccee are automatically forwarded to zzsshh-uusseerrss.
All submissions to zzsshh-uusseerrss are automatically forwarded to zzsshh-wwoorrkk-
eerrss. If you have problems subscribing/unsubscribing to any of the mailinglists, send mail to <
tained by Karsten Thygesen <>. The mailing lists are main- >. The mailing lists are archived; the archives can be accessed via the administrative addresses listed above. There is also a hypertext ar-
chive, maintained by Geoff Wing <>, available at hhttttpp::////wwwwww..zzsshh..oorrgg//mmllaa//. TTHHEE ZZSSHH FFAAQQ Zsh has a list of Frequently Asked Questions (FAQ), maintained by Peter Stephenson < >. It is regularly posted to the newsgroup ccoommpp..uunniixx..sshheellll and the zzsshh-aannnnoouunnccee mailing list. The latest version
can be found at any of the Zsh FTP sites, or athhttttpp::////wwwwww..zzsshh..oorrgg//FFAAQQ//. The contact address for FAQ-related matters
is <>. TTHHEE ZZSSHH WWEEBB PPAAGGEE Zsh has a web page which is located at hhttttpp::////wwwwww..zzsshh..oorrgg//. This is maintained by Karsten Thygesen < >, of SunSITE Denmark. The contact address for web-related matters is <
TTHHEE ZZSSHH UUSSEERRGGUUIIDDEE 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 hhttttpp::////zzsshh..ssuunnssiittee..ddkk//GGuuiiddee//. At the time of writing, chap-
ters dealing with startup files and their contents and the new comple-
tion system were essentially complete. TTHHEE ZZSSHH WWIIKKIIA `wiki' website for zsh has been created at hhttttpp::////wwwwww..zzsshhwwiikkii..oorrgg//.
This is a site which can be added to and modified directly by userswithout any special permission. You can add your own zsh tips and con-
figurations. IINNVVOOCCAATTIIOONN OOPPTTIIOONNSSThe following flags are interpreted by the shell when invoked to deter-
mine where the shell will read commands from:-cc Take the first argument as a command to execute, rather than
reading commands from a script or standard input. If any fur-
ther arguments are given, the first one is assigned to $$00,
rather than being used as a positional parameter.-ii Force shell to be interactive.
-ss Force shell to read commands from the standard input. If the -ss
flag is not present and an argument is given, the first argument is taken to be the pathname of a script to execute. After the first one or two arguments have been appropriated as described above, the remaining arguments are assigned to the positional parameters. For further options, which are common to invocation and the sseettbuiltin, see zshoptions(1).
Options may be specified by name using the -oo option. -oo acts like a
single-letter option, but takes a following string as the option name.
For example,zzsshh -xx -oo sshhwwoorrddsspplliitt ssccrr
runs the script ssccrr, setting the XXTTRRAACCEE option by the correspondingletter `-xx' and the SSHHWWOORRDDSSPPLLIITT option by name. Options may be
turned off by name by using ++oo instead of -oo. -oo can be stacked up
with preceding single-letter options, so for example `-xxoo sshhwwoorrddsspplliitt'
or `-xxoosshhwwoorrddsspplliitt' is equivalent to `-xx -oo sshhwwoorrddsspplliitt'.
Options may also be specified by name in GNU long option style,`--option-name'. When this is done, `-' characters in the option name
are permitted: they are translated into `', and thus ignored. So, forexample, `zzsshh --sshh-wwoorrdd-sspplliitt' invokes zsh with the SSHHWWOORRDDSSPPLLIITT
option turned on. Like other option syntaxes, options can be turnedoff by replacing the initial `-' with a `++'; thus `++-sshh-wwoorrdd-sspplliitt' is
equivalent to `--nnoo-sshh-wwoorrdd-sspplliitt'. Unlike other option syntaxes,
GNU-style long options cannot be stacked with any other options, so for
example `-xx-sshhwwoorrddsspplliitt' is an error, rather than being treated like
`-xx --sshhwwoorrddsspplliitt'.
The special GNU-style option `--vveerrssiioonn' is handled; it sends to stan-
dard output the shell's version information, then exits successfully.`--hheellpp' is also handled; it sends to standard output a list of options
that can be used when invoking the shell, then exits successfully. Option processing may be finished, allowing following arguments thatstart with `-' or `++' to be treated as normal arguments, in two ways.
Firstly, a lone `-' (or `++') as an argument by itself ends option pro-
cessing. Secondly, a special option `--' (or `++-'), which may be spec-
ified on its own (which is the standard POSIX usage) or may be stackedwith preceding options (so `-xx-' is equivalent to `-xx --'). Options
are not permitted to be stacked after `--' (so `-xx-ff' is an error), but
note the GNU-style option form discussed above, where `--sshhwwoorrddsspplliitt'
is permitted and does not end option processing.Except when the sshh/kksshh emulation single-letter options are in effect,
the option `-bb' (or `++bb') ends option processing. `-bb' is like `--',
except that further single-letter options can be stacked after the `-bb'
and will take effect as normal. CCOOMMPPAATTIIBBIILLIITTYYZsh tries to emulate sshh or kksshh when it is invoked as sshh or kksshh respec-
tively; more precisely, it looks at the first letter of the name by which it was invoked, excluding any initial `rr' (assumed to stand for `restricted'), and if that is `ss' or `kk' it will emulate sshh or kksshh. Furthermore, if invoked as ssuu (which happens on certain systems when the shell is executed by the ssuu command), the shell will try to find analternative name from the SSHHEELLLL environment variable and perform emula-
tion based on that.In sshh and kksshh compatibility modes the following parameters are not spe-
cial and not initialized by the shell: AARRGGCC, aarrggvv, ccddppaatthh, ffiiggnnoorree, ffppaatthh, HHIISSTTCCHHAARRSS, mmaaiillppaatthh, MMAANNPPAATTHH, mmaannppaatthh, ppaatthh, pprroommpptt, PPRROOMMPPTT, PPRROOMMPPTT22, PPRROOMMPPTT33, PPRROOMMPPTT44, ppssvvaarr, ssttaattuuss, wwaattcchh.The usual zsh startup/shutdown scripts are not executed. Login shells
source //eettcc//pprrooffiillee followed by $$HHOOMMEE//..pprrooffiillee. If the EENNVV environment
variable is set on invocation, $$EENNVV is sourced after the profile
scripts. The value of EENNVV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a pathname. Note that the PPRRIIVVIILLEEGGEEDD option also affects the execution of startup files. The following options are set if the shell is invoked as sshh or kksshh:NNOOBBAADDPPAATTTTEERRNN, NNOOBBAANNGGHHIISSTT, NNOOBBGGNNIICCEE, NNOOEEQQUUAALLSS, NNOOFFUUNNCC-
TTIIOONNAARRGGZZEERROO, GGLLOOBBSSUUBBSSTT, NNOOGGLLOOBBAALLEEXXPPOORRTT, NNOOHHUUPP, IINNTTEERRAACCTTIIVVEECCOOMM-
MMEENNTTSS, KKSSHHAARRRRAAYYSS, NNOOMMUULLTTIIOOSS, NNOONNOOMMAATTCCHH, NNOONNOOTTIIFFYY, PPOOSSIIXXBBUUIILLTTIINNSS, NNOOPPRROOMMPPTTPPEERRCCEENNTT, RRMMSSTTAARRSSIILLEENNTT, SSHHFFIILLEEEEXXPPAANNSSIIOONN, SSHHGGLLOOBB, SSHHOOPPTTIIOONNLLEETTTTEERRSS, SSHHWWOORRDDSSPPLLIITT. Additionally the BBSSDDEECCHHOO andIIGGNNOORREEBBRRAACCEESS options are set if zsh is invoked as sshh. Also, the
KKSSHHOOPPTTIIOONNPPRRIINNTT, LLOOCCAALLOOPPTTIIOONNSS, PPRROOMMPPTTBBAANNGG, PPRROOMMPPTTSSUUBBSSTT and SSIINN-
GGLLEELLIINNEEZZLLEE options are set if zsh is invoked as kksshh.
RREESSTTRRIICCTTEEDD SSHHEELLLLWhen the basename of the command used to invoke zsh starts with the
letter `rr' or the `-rr' command line option is supplied at invocation,
the shell becomes restricted. Emulation mode is determined after stripping the letter `rr' from the invocation name. The following are disabled in restricted mode: +o changing directories with the ccdd builtin +o changing or unsetting the PPAATTHH, ppaatthh, MMOODDUULLEEPPAATTHH, mmoodduulleeppaatthh,SHELL HISTFILE, HISTSIZE GID, EGID UID, EUID USERNAME,
LLDDLLIIBBRRAARRYYPPAATTHH, LLDDAAOOUUTTLLIIBBRRAARRYYPPAATTHH, LLDDPPRREELLOOAADD and LLDDAAOOUUTTPPRREELLOOAADD parameters +o specifying command names containing // +o specifying command pathnames using hhaasshh +o redirecting output to files +o using the eexxeecc builtin command to replace the shell with another command+o using jjoobbss -ZZ to overwrite the shell process' argument and envi-
ronment space+o using the AARRGGVV00 parameter to override aarrggvv[[00]] for external com-
mands +o turning off restricted mode with sseett ++rr or uunnsseettoopptt RREESSTTRRIICCTTEEDD These restrictions are enforced after processing the startup files.The startup files should set up PPAATTHH to point to a directory of com-
mands which can be safely invoked in the restricted environment. They may also add further restrictions by disabling selected builtins. Restricted mode can also be activated any time by setting the RREESSTTRRIICCTTEEDD option. This immediately enables all the restrictions described above even if the shell still has not processed all startup files. STARTUP/SHUTDOWN FILES Commands are first read from //eettcc//zzsshheennvv; this cannot be overridden. Subsequent behaviour is modified by the RRCCSS and GGLLOOBBAALLRRCCSS options; the former affects all startup files, while the second only affects those in the //eettcc directory. If one of the options is unset at any point, any subsequent startup file(s) of the corresponding type will not beread. It is also possible for a file in $$ZZDDOOTTDDIIRR to re-enable
GGLLOOBBAALLRRCCSS. Both RRCCSS and GGLLOOBBAALLRRCCSS are set by default.Commands are then read from $$ZZDDOOTTDDIIRR//..zzsshheennvv. If the shell is a login
shell, commands are read from //eettcc//zzpprrooffiillee and then $$ZZDDOOTTDDIIRR//..zzpprroo-
ffiillee. Then, if the shell is interactive, commands are read from//eettcc//zzsshhrrcc and then $$ZZDDOOTTDDIIRR//..zzsshhrrcc. Finally, if the shell is a login
shell, //eettcc//zzllooggiinn and $$ZZDDOOTTDDIIRR//..zzllooggiinn are read.
When a login shell exits, the files $$ZZDDOOTTDDIIRR//..zzllooggoouutt and then
//eettcc//zzllooggoouutt are read. This happens with either an explicit exit viathe eexxiitt or llooggoouutt commands, or an implicit exit by reading end-of-file
from the terminal. However, if the shell terminates due to eexxeecc'ing another process, the logout files are not read. These are also affected by the RRCCSS and GGLLOOBBAALLRRCCSS options. Note also that the RRCCSS option affects the saving of history files, i.e. if RRCCSS is unset when the shell exits, no history file will be saved. If ZZDDOOTTDDIIRR is unset, HHOOMMEE is used instead. Those files listed above asbeing in //eettcc may be in another directory, depending on the installa-
tion.As //eettcc//zzsshheennvv 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 testof the form `iiff [[[[ -oo rrccss ]]]];; tthheenn ......' so that it will not be executed
when zsh is invoked with the `-ff' option.
Any of these files may be pre-compiled with the zzccoommppiillee builtin com-
mand (see zshbuiltins(1)). If a compiled file exists (named for the
original file plus the ..zzwwcc extension) and it is newer than the origi-
nal file, the compiled file will be used instead. FILES$$ZZDDOOTTDDIIRR//..zzsshheennvv
$$ZZDDOOTTDDIIRR//..zzpprrooffiillee
$$ZZDDOOTTDDIIRR//..zzsshhrrcc
$$ZZDDOOTTDDIIRR//..zzllooggiinn
$$ZZDDOOTTDDIIRR//..zzllooggoouutt
$${{TTMMPPPPRREEFFIIXX}}** (default is /tmp/zsh*)
//eettcc//zzsshheennvv //eettcc//zzpprrooffiillee //eettcc//zzsshhrrcc //eettcc//zzllooggiinn//eettcc//zzllooggoouutt (installation-specific - //eettcc is the default)
SEE ALSO
sh(1), csh(1), tcsh(1), rc(1), bash(1), ksh(1), zshbuiltins(1), zshcom-
pwid(1), zshcompsys(1), zshcompctl(1), zshexpn(1), zshmisc(1), zshmod-
ules(1), zshoptions(1), zshparam(1), zshzle(1)
IIEEEEEE SSttaannddaarrdd ffoorr iinnffoorrmmaattiioonn TTeecchhnnoollooggyy - PPoorrttaabbllee OOppeerraattiinngg SSyysstteemm
IInntteerrffaaccee ((PPOOSSIIXX)) - PPaarrtt 22:: SShheellll aanndd UUttiilliittiieess, IEEE Inc, 1993, ISBN
1-55937-255-9.
zsh 4.2.3 January 13, 2005 ZSH(1)