1ZSH(1)                      General Commands Manual                     ZSH(1)
2
3
4

NAME

6       zsh - the Z shell
7

OVERVIEW

9       Because  zsh contains many features, the zsh manual has been split into
10       a number of sections:
11
12       zsh          Zsh overview (this section)
13       zshroadmap   Informal introduction to the manual
14       zshmisc      Anything not fitting into the other sections
15       zshexpn      Zsh command and parameter expansion
16       zshparam     Zsh parameters
17       zshoptions   Zsh options
18       zshbuiltins  Zsh built-in functions
19       zshzle       Zsh command line editing
20       zshcompwid   Zsh completion widgets
21       zshcompsys   Zsh completion system
22       zshcompctl   Zsh completion control
23       zshmodules   Zsh loadable modules
24       zshcalsys    Zsh built-in calendar functions
25       zshtcpsys    Zsh built-in TCP functions
26       zshzftpsys   Zsh built-in FTP client
27       zshcontrib   Additional zsh functions and utilities
28       zshall       Meta-man page containing all of the above
29

DESCRIPTION

31       Zsh is a UNIX command interpreter  (shell)  usable  as  an  interactive
32       login  shell  and as a shell script command processor.  Of the standard
33       shells, zsh most closely resembles ksh but includes many  enhancements.
34       Zsh has command line editing, builtin spelling correction, programmable
35       command completion, shell functions (with autoloading), a history mech‐
36       anism, and a host of other features.
37

AUTHOR

39       Zsh  was  originally  written by Paul Falstad <pf@zsh.org>.  Zsh is now
40       maintained by the members of the zsh-workers  mailing  list  <zsh-work‐
41       ers@zsh.org>.   The  development  is  currently  coordinated  by  Peter
42       Stephenson <pws@zsh.org>.  The coordinator can be contacted at <coordi‐
43       nator@zsh.org>, but matters relating to the code should generally go to
44       the mailing list.
45

AVAILABILITY

47       Zsh is available from the following anonymous FTP sites.  These  mirror
48       sites are kept frequently up to date.  The sites marked with (H) may be
49       mirroring ftp.cs.elte.hu instead of the primary site.
50
51       Primary site
52              ftp://ftp.zsh.org/pub/zsh/
53              http://www.zsh.org/pub/zsh/
54
55       Australia
56              ftp://ftp.zsh.org/pub/zsh/
57              http://www.zsh.org/pub/zsh/
58
59       Finland
60              ftp://ftp.funet.fi/pub/unix/shells/zsh/
61
62       Germany
63              ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/  (H)
64              ftp://ftp.gmd.de/packages/zsh/
65              ftp://ftp.uni-trier.de/pub/unix/shell/zsh/
66
67       Hungary
68              ftp://ftp.cs.elte.hu/pub/zsh/
69              http://www.cs.elte.hu/pub/zsh/
70              ftp://ftp.kfki.hu/pub/packages/zsh/
71
72       Israel
73              ftp://ftp.math.technion.ac.il/pub/zsh/
74              http://www.math.technion.ac.il/pub/zsh/
75
76       Japan
77              ftp://ftp.win.ne.jp/pub/shell/zsh/
78
79       Korea
80              ftp://linux.sarang.net/mirror/system/shell/zsh/
81
82       Netherlands
83              ftp://ftp.demon.nl/pub/mirrors/zsh/
84
85       Norway
86              ftp://ftp.uit.no/pub/unix/shells/zsh/
87
88       Poland
89              ftp://sunsite.icm.edu.pl/pub/unix/shells/zsh/
90
91       Romania
92              ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
93              ftp://ftp.kappa.ro/pub/mirrors/ftp.zsh.org/pub/zsh/
94
95       Slovenia
96              ftp://ftp.siol.net/mirrors/zsh/
97
98       Sweden
99              ftp://ftp.lysator.liu.se/pub/unix/zsh/
100
101       UK
102              ftp://ftp.net.lut.ac.uk/zsh/
103              ftp://sunsite.org.uk/packages/zsh/
104
105       USA
106              http://zsh.open-mirror.com/
107
108       The up-to-date source code is available via anonymous CVS and Git  from
109       Sourceforge.   See http://sourceforge.net/projects/zsh/ for details.  A
110       summary of instructions for the CVS and Git archives can  be  found  at
111       http://zsh.sourceforget.net/.
112

MAILING LISTS

114       Zsh has 3 mailing lists:
115
116       <zsh-announce@zsh.org>
117              Announcements about releases, major changes in the shell and the
118              monthly posting of the Zsh FAQ.  (moderated)
119
120       <zsh-users@zsh.org>
121              User discussions.
122
123       <zsh-workers@zsh.org>
124              Hacking, development, bug reports and patches.
125
126       To subscribe or unsubscribe, send mail to the associated administrative
127       address for the mailing list.
128
129       <zsh-announce-subscribe@zsh.org>
130       <zsh-users-subscribe@zsh.org>
131       <zsh-workers-subscribe@zsh.org>
132       <zsh-announce-unsubscribe@zsh.org>
133       <zsh-users-unsubscribe@zsh.org>
134       <zsh-workers-unsubscribe@zsh.org>
135
136       YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED.  All
137       submissions to zsh-announce are automatically forwarded  to  zsh-users.
138       All  submissions  to zsh-users are automatically forwarded to zsh-work‐
139       ers.
140
141       If you have problems subscribing/unsubscribing to any  of  the  mailing
142       lists,  send mail to <listmaster@zsh.org>.  The mailing lists are main‐
143       tained by Karsten Thygesen <karthy@kom.auc.dk>.
144
145       The mailing lists are archived; the archives can be  accessed  via  the
146       administrative  addresses  listed above.  There is also a hypertext ar‐
147       chive,  maintained  by   Geoff   Wing   <gcw@zsh.org>,   available   at
148       http://www.zsh.org/mla/.
149

THE ZSH FAQ

151       Zsh has a list of Frequently Asked Questions (FAQ), maintained by Peter
152       Stephenson <pws@zsh.org>.  It is  regularly  posted  to  the  newsgroup
153       comp.unix.shell  and the zsh-announce mailing list.  The latest version
154       can   be   found   at   any   of   the   Zsh   FTP   sites,    or    at
155       http://www.zsh.org/FAQ/.   The  contact address for FAQ-related matters
156       is <faqmaster@zsh.org>.
157

THE ZSH WEB PAGE

159       Zsh has a web page which is located at  http://www.zsh.org/.   This  is
160       maintained  by  Karsten  Thygesen <karthy@zsh.org>, of SunSITE Denmark.
161       The contact address for web-related matters is <webmaster@zsh.org>.
162

THE ZSH USERGUIDE

164       A userguide is currently in preparation.  It is intended to  complement
165       the  manual, with explanations and hints on issues where the manual can
166       be cabbalistic, hierographic, or downright mystifying (for example, the
167       word  `hierographic'  does not exist).  It can be viewed in its current
168       state at http://zsh.sourceforge.net/Guide/.  At the  time  of  writing,
169       chapters dealing with startup files and their contents and the new com‐
170       pletion system were essentially complete.
171

THE ZSH WIKI

173       A `wiki' website for zsh has been created  at  http://www.zshwiki.org/.
174       This  is  a  site  which can be added to and modified directly by users
175       without any special permission.  You can add your own zsh tips and con‐
176       figurations.
177

INVOCATION

179       The following flags are interpreted by the shell when invoked to deter‐
180       mine where the shell will read commands from:
181
182       -c     Take the first argument as a command  to  execute,  rather  than
183              reading  commands  from a script or standard input.  If any fur‐
184              ther arguments are given, the  first  one  is  assigned  to  $0,
185              rather than being used as a positional parameter.
186
187       -i     Force  shell to be interactive.  It is still possible to specify
188              a script to execute.
189
190       -s     Force shell to read commands from the standard input.  If the -s
191              flag is not present and an argument is given, the first argument
192              is taken to be the pathname of a script to execute.
193
194       If there are any remaining arguments after option processing, and  nei‐
195       ther  of the options -c or -s was supplied, the first argument is taken
196       as the file name of a script containing shell commands to be  executed.
197       If  the option PATH_SCRIPT is set, and the file name does not contain a
198       directory path (i.e. there is no `/' in the name),  first  the  current
199       directory  and  then  the  command  path given by the variable PATH are
200       searched for the script.  If the option is not set  or  the  file  name
201       contains a `/' it is used directly.
202
203       After  the  first  one  or  two  arguments  have  been  appropriated as
204       described above, the remaining arguments are assigned to the positional
205       parameters.
206
207       For  further  options,  which  are  common  to  invocation  and the set
208       builtin, see zshoptions(1).
209
210       Options may be specified by name using the -o option.  -o acts  like  a
211       single-letter  option, but takes a following string as the option name.
212       For example,
213
214              zsh -x -o shwordsplit scr
215
216       runs the script scr, setting the XTRACE  option  by  the  corresponding
217       letter  `-x'  and  the  SH_WORD_SPLIT  option  by name.  Options may be
218       turned off by name by using +o instead of -o.  -o  can  be  stacked  up
219       with  preceding single-letter options, so for example `-xo shwordsplit'
220       or `-xoshwordsplit' is equivalent to `-x -o shwordsplit'.
221
222       Options may also be  specified  by  name  in  GNU  long  option  style,
223       `--option-name'.   When this is done, `-' characters in the option name
224       are permitted: they are translated into `_', and thus ignored.  So, for
225       example,  `zsh  --sh-word-split'  invokes  zsh  with  the SH_WORD_SPLIT
226       option turned on.  Like other option syntaxes, options  can  be  turned
227       off  by replacing the initial `-' with a `+'; thus `+-sh-word-split' is
228       equivalent to  `--no-sh-word-split'.   Unlike  other  option  syntaxes,
229       GNU-style long options cannot be stacked with any other options, so for
230       example `-x-shwordsplit' is an error, rather than  being  treated  like
231       `-x --shwordsplit'.
232
233       The  special GNU-style option `--version' is handled; it sends to stan‐
234       dard output the shell's version information, then  exits  successfully.
235       `--help' is also handled; it sends to standard output a list of options
236       that can be used when invoking the shell, then exits successfully.
237
238       Option processing may be finished, allowing  following  arguments  that
239       start  with  `-' or `+' to be treated as normal arguments, in two ways.
240       Firstly, a lone `-' (or `+') as an argument by itself ends option  pro‐
241       cessing.  Secondly, a special option `--' (or `+-'), which may be spec‐
242       ified on its own (which is the standard POSIX usage) or may be  stacked
243       with  preceding  options  (so `-x-' is equivalent to `-x --').  Options
244       are not permitted to be stacked after `--' (so `-x-f' is an error), but
245       note  the  GNU-style option form discussed above, where `--shwordsplit'
246       is permitted and does not end option processing.
247
248       Except when the sh/ksh emulation single-letter options are  in  effect,
249       the  option  `-b' (or `+b') ends option processing.  `-b' is like `--',
250       except that further single-letter options can be stacked after the `-b'
251       and will take effect as normal.
252

COMPATIBILITY

254       Zsh  tries to emulate sh or ksh when it is invoked as sh or ksh respec‐
255       tively; more precisely, it looks at the first letter  of  the  name  by
256       which  it  was invoked, excluding any initial `r' (assumed to stand for
257       `restricted'), and if that is `b', `s' or `k' it  will  emulate  sh  or
258       ksh.   Furthermore,  if invoked as su (which happens on certain systems
259       when the shell is executed by the su command), the shell  will  try  to
260       find  an  alternative name from the SHELL environment variable and per‐
261       form emulation based on that.
262
263       In sh and ksh compatibility modes the following parameters are not spe‐
264       cial  and  not  initialized  by the shell: ARGC, argv, cdpath, fignore,
265       fpath, HISTCHARS, mailpath, MANPATH,  manpath,  path,  prompt,  PROMPT,
266       PROMPT2, PROMPT3, PROMPT4, psvar, status, watch.
267
268       The  usual zsh startup/shutdown scripts are not executed.  Login shells
269       source /etc/profile followed by $HOME/.profile.  If the ENV environment
270       variable  is  set  on  invocation,  $ENV  is  sourced after the profile
271       scripts.  The value of ENV is subjected to parameter expansion, command
272       substitution,  and  arithmetic  expansion before being interpreted as a
273       pathname.  Note that the PRIVILEGED option also affects  the  execution
274       of startup files.
275
276       The  following  options  are  set if the shell is invoked as sh or ksh:
277       NO_BAD_PATTERN,   NO_BANG_HIST,   NO_BG_NICE,    NO_EQUALS,    NO_FUNC‐
278       TION_ARGZERO,  GLOB_SUBST,  NO_GLOBAL_EXPORT,  NO_HUP, INTERACTIVE_COM‐
279       MENTS, KSH_ARRAYS, NO_MULTIOS, NO_NOMATCH,  NO_NOTIFY,  POSIX_BUILTINS,
280       NO_PROMPT_PERCENT,    RM_STAR_SILENT,    SH_FILE_EXPANSION,    SH_GLOB,
281       SH_OPTION_LETTERS,  SH_WORD_SPLIT.   Additionally  the   BSD_ECHO   and
282       IGNORE_BRACES  options  are  set  if  zsh  is invoked as sh.  Also, the
283       KSH_OPTION_PRINT, LOCAL_OPTIONS,  PROMPT_BANG,  PROMPT_SUBST  and  SIN‐
284       GLE_LINE_ZLE options are set if zsh is invoked as ksh.
285

RESTRICTED SHELL

287       When  the  basename  of  the command used to invoke zsh starts with the
288       letter `r' or the `-r' command line option is supplied  at  invocation,
289       the  shell  becomes  restricted.   Emulation  mode  is determined after
290       stripping the letter `r' from the invocation name.  The  following  are
291       disabled in restricted mode:
292
293       ·      changing directories with the cd builtin
294
295       ·      changing  or unsetting the PATH, path, MODULE_PATH, module_path,
296              SHELL, HISTFILE,  HISTSIZE,  GID,  EGID,  UID,  EUID,  USERNAME,
297              LD_LIBRARY_PATH,     LD_AOUT_LIBRARY_PATH,     LD_PRELOAD    and
298              LD_AOUT_PRELOAD parameters
299
300       ·      specifying command names containing /
301
302       ·      specifying command pathnames using hash
303
304       ·      redirecting output to files
305
306       ·      using the exec builtin command to replace the shell with another
307              command
308
309       ·      using jobs -Z to overwrite the shell process' argument and envi‐
310              ronment space
311
312       ·      using the ARGV0 parameter to override argv[0] for external  com‐
313              mands
314
315       ·      turning off restricted mode with set +r or unsetopt RESTRICTED
316
317       These  restrictions  are  enforced  after processing the startup files.
318       The startup files should set up PATH to point to a  directory  of  com‐
319       mands  which can be safely invoked in the restricted environment.  They
320       may also add further restrictions by disabling selected builtins.
321
322       Restricted  mode  can  also  be  activated  any  time  by  setting  the
323       RESTRICTED  option.   This  immediately  enables  all  the restrictions
324       described above even if the shell still has not processed  all  startup
325       files.
326

STARTUP/SHUTDOWN FILES

328       Commands  are  first  read from /etc/zshenv; this cannot be overridden.
329       Subsequent behaviour is modified by the RCS and GLOBAL_RCS options; the
330       former  affects all startup files, while the second only affects global
331       startup files (those shown here with an path starting with  a  /).   If
332       one  of  the  options  is  unset  at  any point, any subsequent startup
333       file(s) of the corresponding type will not be read.  It is also  possi‐
334       ble  for  a  file  in  $ZDOTDIR  to  re-enable GLOBAL_RCS. Both RCS and
335       GLOBAL_RCS are set by default.
336
337       Commands are then read from $ZDOTDIR/.zshenv.  If the shell is a  login
338       shell,  commands  are  read from /etc/zprofile and then $ZDOTDIR/.zpro‐
339       file.  Then, if the  shell  is  interactive,  commands  are  read  from
340       /etc/zshrc  and then $ZDOTDIR/.zshrc.  Finally, if the shell is a login
341       shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
342
343       When  a  login  shell  exits,  the  files  $ZDOTDIR/.zlogout  and  then
344       /etc/zlogout  are  read.  This happens with either an explicit exit via
345       the exit or logout commands, or an implicit exit by reading end-of-file
346       from  the  terminal.   However, if the shell terminates due to exec'ing
347       another process, the  logout  files  are  not  read.   These  are  also
348       affected  by  the  RCS  and GLOBAL_RCS options.  Note also that the RCS
349       option affects the saving of history files, i.e. if RCS is  unset  when
350       the shell exits, no history file will be saved.
351
352       If ZDOTDIR is unset, HOME is used instead.  Files listed above as being
353       in /etc may be in another directory, depending on the installation.
354
355       As /etc/zshenv is run for all instances of zsh, it is important that it
356       be  kept as small as possible.  In particular, it is a good idea to put
357       code that does not need to be run for every single shell behind a  test
358       of the form `if [[ -o rcs ]]; then ...' so that it will not be executed
359       when zsh is invoked with the `-f' option.
360
361       Any of these files may be pre-compiled with the zcompile  builtin  com‐
362       mand  (see  zshbuiltins(1)).   If a compiled file exists (named for the
363       original file plus the .zwc extension) and it is newer than the  origi‐
364       nal file, the compiled file will be used instead.
365

FILES

367       $ZDOTDIR/.zshenv
368       $ZDOTDIR/.zprofile
369       $ZDOTDIR/.zshrc
370       $ZDOTDIR/.zlogin
371       $ZDOTDIR/.zlogout
372       ${TMPPREFIX}*   (default is /tmp/zsh*)
373       /etc/zshenv
374       /etc/zprofile
375       /etc/zshrc
376       /etc/zlogin
377       /etc/zlogout    (installation-specific - /etc is the default)
378

SEE ALSO

380       sh(1), csh(1), tcsh(1), rc(1), bash(1), ksh(1), zshbuiltins(1), zshcom‐
381       pwid(1), zshcompsys(1), zshcompctl(1), zshexpn(1), zshmisc(1),  zshmod‐
382       ules(1), zshoptions(1), zshparam(1), zshzle(1)
383
384       IEEE  Standard  for  information Technology - Portable Operating System
385       Interface (POSIX) - Part 2: Shell and Utilities, IEEE Inc,  1993,  ISBN
386       1-55937-255-9.
387
388
389
390zsh 4.3.11                     December 20, 2010                        ZSH(1)
Impressum