zshall.1   [plain text]


.TH "ZSHALL" "1" "October 30, 2008" "zsh 4\&.3\&.9"
.SH "NAME"
zshall \- the Z shell meta\-man page
.\" Yodl file: Zsh/intro.yo
.SH "OVERVIEW"
Because zsh contains many features, the zsh manual has been split into
a number of sections\&.  This manual page includes all the separate manual pages in the
following order:
.PP
.PD 0
.TP
\fIzshroadmap\fP   Informal introduction to the manual
.TP
\fIzshmisc\fP      Anything not fitting into the other sections
.TP
\fIzshexpn\fP      Zsh command and parameter expansion
.TP
\fIzshparam\fP     Zsh parameters
.TP
\fIzshoptions\fP   Zsh options
.TP
\fIzshbuiltins\fP  Zsh built\-in functions
.TP
\fIzshzle\fP       Zsh command line editing
.TP
\fIzshcompwid\fP   Zsh completion widgets
.TP
\fIzshcompsys\fP   Zsh completion system
.TP
\fIzshcompctl\fP   Zsh completion control
.TP
\fIzshmodules\fP   Zsh loadable modules
.TP
\fIzshtcpsys\fP    Zsh built\-in TCP functions
.TP
\fIzshzftpsys\fP   Zsh built\-in FTP client
.TP
\fIzshcontrib\fP   Additional zsh functions and utilities
.PD
.SH "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 \fBksh\fP but includes many enhancements\&.  Zsh
has command line editing, builtin spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and a host of other features\&.
.\" Yodl file: Zsh/metafaq.yo
.SH "AUTHOR"
Zsh was originally written by Paul Falstad \fB<pf@zsh\&.org>\fP\&.
Zsh is now maintained by the members of the zsh\-workers mailing
list \fB<zsh\-workers@sunsite\&.dk>\fP\&.  The development is currently
coordinated by Peter Stephenson \fB<pws@zsh\&.org>\fP\&.  The coordinator
can be contacted at \fB<coordinator@zsh\&.org>\fP, but matters relating to
the code should generally go to the mailing list\&.
.SH "AVAILABILITY"
Zsh is available from the following anonymous FTP sites\&.  These mirror
sites are kept frequently up to date\&.  The sites marked with \fI(H)\fP may be
mirroring \fBftp\&.cs\&.elte\&.hu\fP instead of the primary site\&.
.PP
.PD 0
.TP
.PD
Primary site
.nf
\fBftp://ftp\&.zsh\&.org/pub/zsh/\fP
\fBhttp://www\&.zsh\&.org/pub/zsh/\fP
.fi
.TP
Australia
.nf
\fBftp://ftp\&.zsh\&.org/pub/zsh/\fP
\fBhttp://www\&.zsh\&.org/pub/zsh/\fP
.fi
.TP
Denmark
.nf
\fBftp://sunsite\&.dk/pub/unix/shells/zsh/\fP
.fi
.TP
Finland
.nf
\fBftp://ftp\&.funet\&.fi/pub/unix/shells/zsh/\fP
.fi
.TP
Germany
.nf
\fBftp://ftp\&.fu\-berlin\&.de/pub/unix/shells/zsh/\fP  \fI(H)\fP
\fBftp://ftp\&.gmd\&.de/packages/zsh/\fP
\fBftp://ftp\&.uni\-trier\&.de/pub/unix/shell/zsh/\fP
.fi
.TP
Hungary
.nf
\fBftp://ftp\&.cs\&.elte\&.hu/pub/zsh/\fP
\fBhttp://www\&.cs\&.elte\&.hu/pub/zsh/\fP
\fBftp://ftp\&.kfki\&.hu/pub/packages/zsh/\fP
.fi
.TP
Israel
.nf
\fBftp://ftp\&.math\&.technion\&.ac\&.il/pub/zsh/\fP
\fBhttp://www\&.math\&.technion\&.ac\&.il/pub/zsh/\fP
.fi
.TP
Japan
.nf
\fBftp://ftp\&.win\&.ne\&.jp/pub/shell/zsh/\fP
.fi
.TP
Korea
.nf
\fBftp://linux\&.sarang\&.net/mirror/system/shell/zsh/\fP
.fi
.TP
Netherlands
.nf
\fBftp://ftp\&.demon\&.nl/pub/mirrors/zsh/\fP
.fi
.TP
Norway
.nf
\fBftp://ftp\&.uit\&.no/pub/unix/shells/zsh/\fP
.fi
.TP
Poland
.nf
\fBftp://sunsite\&.icm\&.edu\&.pl/pub/unix/shells/zsh/\fP
.fi
.TP
Romania
.nf
\fBftp://ftp\&.roedu\&.net/pub/mirrors/ftp\&.zsh\&.org/pub/zsh/\fP
\fBftp://ftp\&.kappa\&.ro/pub/mirrors/ftp\&.zsh\&.org/pub/zsh/\fP
.fi
.TP
Slovenia
.nf
\fBftp://ftp\&.siol\&.net/mirrors/zsh/\fP
.fi
.TP
Sweden
.nf
\fBftp://ftp\&.lysator\&.liu\&.se/pub/unix/zsh/\fP
.fi
.TP
UK
.nf
\fBftp://ftp\&.net\&.lut\&.ac\&.uk/zsh/\fP
\fBftp://sunsite\&.org\&.uk/packages/zsh/\fP
.fi
.TP
USA
.nf
\fBhttp://zsh\&.open\-mirror\&.com/\fP
.fi
.PP
The up\-to\-date source code is available via anonymous CVS from Sourceforge\&.
See \fBhttp://sourceforge\&.net/projects/zsh/\fP for details\&.
.PP
.SH "MAILING LISTS"
Zsh has 3 mailing lists:
.PP
.PD 0
.TP
.PD
\fB<zsh\-announce@sunsite\&.dk>\fP
Announcements about releases, major changes in the shell and the
monthly posting of the Zsh FAQ\&.  (moderated)
.TP
\fB<zsh\-users@sunsite\&.dk>\fP
User discussions\&.
.TP
\fB<zsh\-workers@sunsite\&.dk>\fP
Hacking, development, bug reports and patches\&.
.PP
To subscribe or unsubscribe, send mail
to the associated administrative address for the mailing list\&.
.PP
.PD 0
.TP
\fB<zsh\-announce\-subscribe@sunsite\&.dk>\fP
.TP
\fB<zsh\-users\-subscribe@sunsite\&.dk>\fP
.TP
\fB<zsh\-workers\-subscribe@sunsite\&.dk>\fP
.PP
.TP
\fB<zsh\-announce\-unsubscribe@sunsite\&.dk>\fP
.TP
\fB<zsh\-users\-unsubscribe@sunsite\&.dk>\fP
.TP
\fB<zsh\-workers\-unsubscribe@sunsite\&.dk>\fP
.PD
.PP
YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED\&.
All submissions to \fBzsh\-announce\fP are automatically forwarded to
\fBzsh\-users\fP\&.  All submissions to \fBzsh\-users\fP are automatically
forwarded to \fBzsh\-workers\fP\&.
.PP
If you have problems subscribing/unsubscribing to any of the mailing
lists, send mail to \fB<listmaster@zsh\&.org>\fP\&.  The mailing lists are
maintained by Karsten Thygesen \fB<karthy@kom\&.auc\&.dk>\fP\&.
.PP
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above\&.  There is also a hypertext
archive, maintained by Geoff Wing \fB<gcw@zsh\&.org>\fP, available at
\fBhttp://www\&.zsh\&.org/mla/\fP\&.
.SH "THE ZSH FAQ"
Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson \fB<pws@zsh\&.org>\fP\&.  It is regularly posted to the
newsgroup \fBcomp\&.unix\&.shell\fP and the \fBzsh\-announce\fP mailing list\&.
The latest version can be found at any of the Zsh FTP sites, or at
\fBhttp://www\&.zsh\&.org/FAQ/\fP\&.  The contact address for FAQ\-related matters
is \fB<faqmaster@zsh\&.org>\fP\&.
.SH "THE ZSH WEB PAGE"
Zsh has a web page which is located at \fBhttp://www\&.zsh\&.org/\fP\&.  This is
maintained by Karsten Thygesen \fB<karthy@zsh\&.org>\fP, of SunSITE Denmark\&.
The contact address for web\-related matters is \fB<webmaster@zsh\&.org>\fP\&.
.SH "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
\fBhttp://zsh\&.sunsite\&.dk/Guide/\fP\&.  At the time of writing, chapters
dealing with startup files and their contents and the new completion system
were essentially complete\&.
.SH "THE ZSH WIKI"
A `wiki' website for zsh has been created at \fBhttp://www\&.zshwiki\&.org/\fP\&.
This is a site which can be added to and modified directly by users without
any special permission\&.  You can add your own zsh tips and configurations\&.
.\" Yodl file: Zsh/invoke.yo
.SH "INVOCATION OPTIONS"
The following flags are interpreted by the shell when invoked to determine
where the shell will read commands from:
.PP
.PD 0
.TP
.PD
\fB\-c\fP
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 \fB$0\fP, rather than being used as a positional
parameter\&.
.TP
\fB\-i\fP
Force shell to be interactive\&.
.TP
\fB\-s\fP
Force shell to read commands from the standard input\&.
If the \fB\-s\fP flag is not present and an argument is given,
the first argument is taken to be the pathname of a script to
execute\&.
.PP
After the first one or two arguments have been appropriated as described above,
the remaining arguments are assigned to the positional parameters\&.
.PP
For further options, which are common to invocation and the \fBset\fP
builtin, see
\fIzshoptions\fP(1)\&.
.PP
Options may be specified by name using the \fB\-o\fP option\&.  \fB\-o\fP acts like
a single\-letter option, but takes a following string as the option name\&.
For example,
.PP
.RS
.nf
\fBzsh \-x \-o shwordsplit scr\fP
.fi
.RE
.PP
runs the script \fBscr\fP, setting the \fBXTRACE\fP option by the corresponding
letter `\fB\-x\fP' and the \fBSH_WORD_SPLIT\fP option by name\&.
Options may be turned \fIoff\fP by name by using \fB+o\fP instead of \fB\-o\fP\&.
\fB\-o\fP can be stacked up with preceding single\-letter options, so for example
`\fB\-xo shwordsplit\fP' or `\fB\-xoshwordsplit\fP' is equivalent to
`\fB\-x \-o shwordsplit\fP'\&.
.PP
Options may also be specified by name in GNU long option style,
`\fB\-\fP\fB\-\fP\fIoption\-name\fP'\&.  When this is done, `\fB\-\fP' characters in the
option name are permitted: they are translated into `\fB_\fP', and thus ignored\&.
So, for example, `\fBzsh \-\fP\fB\-sh\-word\-split\fP' invokes zsh with the
\fBSH_WORD_SPLIT\fP option turned on\&.  Like other option syntaxes, options can
be turned off by replacing the initial `\fB\-\fP' with a `\fB+\fP'; thus
`\fB+\-sh\-word\-split\fP' is equivalent to `\fB\-\fP\fB\-no\-sh\-word\-split\fP'\&.
Unlike other option syntaxes, GNU\-style long options cannot be stacked with
any other options, so for example `\fB\-x\-shwordsplit\fP' is an error,
rather than being treated like `\fB\-x \-\fP\fB\-shwordsplit\fP'\&.
.PP
The special GNU\-style option `\fB\-\fP\fB\-version\fP' is handled; it sends to
standard output the shell's version information, then exits successfully\&.
`\fB\-\fP\fB\-help\fP' is also handled; it sends to standard output a list of
options that can be used when invoking the shell, then exits successfully\&.
.PP
Option processing may be finished, allowing following arguments that start with
`\fB\-\fP' or `\fB+\fP' to be treated as normal arguments, in two ways\&.
Firstly, a lone `\fB\-\fP' (or `\fB+\fP') as an argument by itself ends
option processing\&.  Secondly, a special option `\fB\-\fP\fB\-\fP' (or
`\fB+\-\fP'), which may be specified on its own (which is the standard
POSIX usage) or may be stacked with preceding options (so `\fB\-x\-\fP' is
equivalent to `\fB\-x \-\fP\fB\-\fP')\&.  Options are not permitted to be stacked
after `\fB\-\fP\fB\-\fP' (so `\fB\-x\-f\fP' is an error), but note the GNU\-style
option form discussed above, where `\fB\-\fP\fB\-shwordsplit\fP' is permitted
and does not end option processing\&.
.PP
Except when the \fBsh\fP/\fBksh\fP emulation single\-letter options are in effect,
the option `\fB\-b\fP' (or `\fB+b\fP') ends option processing\&.
`\fB\-b\fP' is like `\fB\-\fP\fB\-\fP', except that further single\-letter options
can be stacked after the `\fB\-b\fP' and will take effect as normal\&.
.PP
.PP
.\" Yodl file: Zsh/compat.yo
.SH "COMPATIBILITY"
Zsh tries to emulate \fBsh\fP or \fBksh\fP when it is invoked as
\fBsh\fP or \fBksh\fP respectively; more precisely, it looks at the first
letter of the name by which it was invoked, excluding any initial `\fBr\fP'
(assumed to stand for `restricted'), and if that is `\fBs\fP' or `\fBk\fP' it
will emulate \fBsh\fP or \fBksh\fP\&.  Furthermore, if invoked as \fBsu\fP (which
happens on certain systems when the shell is executed by the \fBsu\fP
command), the shell will try to find an alternative name from the \fBSHELL\fP
environment variable and perform emulation based on that\&.
.PP
In \fBsh\fP and \fBksh\fP compatibility modes the following
parameters are not special and not initialized by the shell:
\fBARGC\fP,
\fBargv\fP,
\fBcdpath\fP,
\fBfignore\fP,
\fBfpath\fP,
\fBHISTCHARS\fP,
\fBmailpath\fP,
\fBMANPATH\fP,
\fBmanpath\fP,
\fBpath\fP,
\fBprompt\fP,
\fBPROMPT\fP,
\fBPROMPT2\fP,
\fBPROMPT3\fP,
\fBPROMPT4\fP,
\fBpsvar\fP,
\fBstatus\fP,
\fBwatch\fP\&.
.PP
The usual zsh startup/shutdown scripts are not executed\&.  Login shells
source \fB/etc/profile\fP followed by \fB$HOME/\&.profile\fP\&.  If the
\fBENV\fP environment variable is set on invocation, \fB$ENV\fP is sourced
after the profile scripts\&.  The value of \fBENV\fP is subjected to
parameter expansion, command substitution, and arithmetic expansion
before being interpreted as a pathname\&.  Note that the \fBPRIVILEGED\fP
option also affects the execution of startup files\&.
.PP
The following options are set if the shell is invoked as \fBsh\fP or
\fBksh\fP:
\fBNO_BAD_PATTERN\fP,
\fBNO_BANG_HIST\fP,
\fBNO_BG_NICE\fP,
\fBNO_EQUALS\fP,
\fBNO_FUNCTION_ARGZERO\fP,
\fBGLOB_SUBST\fP,
\fBNO_GLOBAL_EXPORT\fP,
\fBNO_HUP\fP,
\fBINTERACTIVE_COMMENTS\fP,
\fBKSH_ARRAYS\fP,
\fBNO_MULTIOS\fP,
\fBNO_NOMATCH\fP,
\fBNO_NOTIFY\fP,
\fBPOSIX_BUILTINS\fP,
\fBNO_PROMPT_PERCENT\fP,
\fBRM_STAR_SILENT\fP,
\fBSH_FILE_EXPANSION\fP,
\fBSH_GLOB\fP,
\fBSH_OPTION_LETTERS\fP,
\fBSH_WORD_SPLIT\fP\&.
Additionally the \fBBSD_ECHO\fP and \fBIGNORE_BRACES\fP
options are set if zsh is invoked as \fBsh\fP\&.
Also, the
\fBKSH_OPTION_PRINT\fP,
\fBLOCAL_OPTIONS\fP,
\fBPROMPT_BANG\fP,
\fBPROMPT_SUBST\fP
and
\fBSINGLE_LINE_ZLE\fP
options are set if zsh is invoked as \fBksh\fP\&.
.\" Yodl file: Zsh/restricted.yo
.SH "RESTRICTED SHELL"
When the basename of the command used to invoke zsh starts with the letter
`\fBr\fP' or the `\fB\-r\fP' command line option is supplied at invocation, the
shell becomes restricted\&.  Emulation mode is determined after stripping the
letter `\fBr\fP' from the invocation name\&.  The following are disabled in
restricted mode:
.PP
.PD 0
.TP
.PD
\(bu
changing directories with the \fBcd\fP builtin
.TP
\(bu
changing or unsetting the \fBPATH\fP, \fBpath\fP, \fBMODULE_PATH\fP,
\fBmodule_path\fP, \fBSHELL\fP, \fBHISTFILE\fP, \fBHISTSIZE\fP, \fBGID\fP, \fBEGID\fP,
\fBUID\fP, \fBEUID\fP, \fBUSERNAME\fP, \fBLD_LIBRARY_PATH\fP,
\fBLD_AOUT_LIBRARY_PATH\fP, \fBLD_PRELOAD\fP and  \fBLD_AOUT_PRELOAD\fP
parameters
.TP
\(bu
specifying command names containing \fB/\fP
.TP
\(bu
specifying command pathnames using \fBhash\fP
.TP
\(bu
redirecting output to files
.TP
\(bu
using the \fBexec\fP builtin command to replace the shell with another
command
.TP
\(bu
using \fBjobs \-Z\fP to overwrite the shell process' argument and
environment space
.TP
\(bu
using the \fBARGV0\fP parameter to override \fBargv[0]\fP for external
commands
.TP
\(bu
turning off restricted mode with \fBset +r\fP or \fBunsetopt
RESTRICTED\fP
.PP
These restrictions are enforced after processing the startup files\&.  The
startup files should set up \fBPATH\fP to point to a directory of commands
which can be safely invoked in the restricted environment\&.  They may also
add further restrictions by disabling selected builtins\&.
.PP
Restricted mode can also be activated any time by setting the
\fBRESTRICTED\fP option\&.  This immediately enables all the restrictions
described above even if the shell still has not processed all startup
files\&.
.\" Yodl file: Zsh/files.yo
.SH "STARTUP/SHUTDOWN FILES"
Commands are first read from \fB/etc/zshenv\fP; this cannot be overridden\&.
Subsequent behaviour is modified by the \fBRCS\fP and
\fBGLOBAL_RCS\fP options; the former affects all startup files, while the
second only affects global startup files (those shown here with an
path starting with a \fB/\fP)\&.  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 \fB$ZDOTDIR\fP to
re\-enable \fBGLOBAL_RCS\fP\&. Both \fBRCS\fP and \fBGLOBAL_RCS\fP are set by
default\&.
.PP
Commands are then read from \fB$ZDOTDIR/\&.zshenv\fP\&.
If the shell is a login shell, commands
are read from \fB/etc/zprofile\fP and then \fB$ZDOTDIR/\&.zprofile\fP\&.
Then, if the shell is interactive,
commands are read from \fB/etc/zshrc\fP and then \fB$ZDOTDIR/\&.zshrc\fP\&.
Finally, if the shell is a login shell, \fB/etc/zlogin\fP and
\fB$ZDOTDIR/\&.zlogin\fP are read\&.
.PP
When a login shell exits, the files \fB$ZDOTDIR/\&.zlogout\fP and then
\fB/etc/zlogout\fP are read\&.  This happens with either an explicit exit
via the \fBexit\fP or \fBlogout\fP commands, or an implicit exit by reading
end\-of\-file from the terminal\&.  However, if the shell terminates due
to \fBexec\fP'ing another process, the logout files are not read\&.
These are also affected by the \fBRCS\fP and \fBGLOBAL_RCS\fP options\&.
Note also that the \fBRCS\fP option affects the saving of history files,
i\&.e\&. if \fBRCS\fP is unset when the shell exits, no history file will be
saved\&.
.PP
If \fBZDOTDIR\fP is unset, \fBHOME\fP is used instead\&.
Files listed above as being in \fB/etc\fP may be in another
directory, depending on the installation\&.
.PP
As \fB/etc/zshenv\fP 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 `\fBif [[ \-o rcs ]]; then \&.\&.\&.\fP' so that it will not
be executed when zsh is invoked with the `\fB\-f\fP' option\&.
.PP
Any of these files may be pre\-compiled with the \fBzcompile\fP builtin
command (see \fIzshbuiltins\fP(1))\&.  If a compiled file exists (named for the original file plus the
\fB\&.zwc\fP extension) and it is newer than the original file, the compiled
file will be used instead\&.
.so man1/zshroadmap.1
.so man1/zshmisc.1
.so man1/zshexpn.1
.so man1/zshparam.1
.so man1/zshoptions.1
.so man1/zshbuiltins.1
.so man1/zshzle.1
.so man1/zshcompwid.1
.so man1/zshcompsys.1
.so man1/zshcompctl.1
.so man1/zshmodules.1
.so man1/zshtcpsys.1
.so man1/zshzftpsys.1
.so man1/zshcontrib.1
.TH "ZSHALL" "1" "October 30, 2008" "zsh 4\&.3\&.9"
.\" Yodl file: Zsh/filelist.yo
.SH "FILES"
.PD 0
.TP
\fB$ZDOTDIR/\&.zshenv\fP
.TP
\fB$ZDOTDIR/\&.zprofile\fP
.TP
\fB$ZDOTDIR/\&.zshrc\fP
.TP
\fB$ZDOTDIR/\&.zlogin\fP
.TP
\fB$ZDOTDIR/\&.zlogout\fP
.TP
\fB${TMPPREFIX}*\fP   (default is /tmp/zsh*)
.TP
\fB/etc/zshenv\fP
.TP
\fB/etc/zprofile\fP
.TP
\fB/etc/zshrc\fP
.TP
\fB/etc/zlogin\fP
.TP
\fB/etc/zlogout\fP    (installation\-specific \- \fB/etc\fP is the default)
.PD
.\" Yodl file: Zsh/seealso.yo
.SH "SEE ALSO"
\fIsh\fP(1),
\fIcsh\fP(1),
\fItcsh\fP(1),
\fIrc\fP(1),
\fIbash\fP(1),
\fIksh\fP(1)
.PP
\fBIEEE Standard for information Technology \-
Portable Operating System Interface (POSIX) \-
Part 2: Shell and Utilities\fP,
IEEE Inc, 1993, ISBN 1\-55937\-255\-9\&.