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@sunsite.dk>.   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       Denmark
60              ftp://sunsite.dk/pub/unix/shells/zsh/
61
62       Finland
63              ftp://ftp.funet.fi/pub/unix/shells/zsh/
64
65       Germany
66              ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/  (H)
67              ftp://ftp.gmd.de/packages/zsh/
68              ftp://ftp.uni-trier.de/pub/unix/shell/zsh/
69
70       Hungary
71              ftp://ftp.cs.elte.hu/pub/zsh/
72              http://www.cs.elte.hu/pub/zsh/
73              ftp://ftp.kfki.hu/pub/packages/zsh/
74
75       Israel
76              ftp://ftp.math.technion.ac.il/pub/zsh/
77              http://www.math.technion.ac.il/pub/zsh/
78
79       Japan
80              ftp://ftp.win.ne.jp/pub/shell/zsh/
81
82       Korea
83              ftp://linux.sarang.net/mirror/system/shell/zsh/
84
85       Netherlands
86              ftp://ftp.demon.nl/pub/mirrors/zsh/
87
88       Norway
89              ftp://ftp.uit.no/pub/unix/shells/zsh/
90
91       Poland
92              ftp://sunsite.icm.edu.pl/pub/unix/shells/zsh/
93
94       Romania
95              ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/
96              ftp://ftp.kappa.ro/pub/mirrors/ftp.zsh.org/pub/zsh/
97
98       Slovenia
99              ftp://ftp.siol.net/mirrors/zsh/
100
101       Sweden
102              ftp://ftp.lysator.liu.se/pub/unix/zsh/
103
104       UK
105              ftp://ftp.net.lut.ac.uk/zsh/
106              ftp://sunsite.org.uk/packages/zsh/
107
108       USA
109              http://zsh.open-mirror.com/
110
111       The up-to-date source code is available via anonymous CVS from  Source‐
112       forge.  See http://sourceforge.net/projects/zsh/ for details.
113

MAILING LISTS

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

THE ZSH FAQ

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

THE ZSH WEB PAGE

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

THE ZSH USERGUIDE

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

THE ZSH WIKI

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

INVOCATION OPTIONS

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

COMPATIBILITY

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

RESTRICTED SHELL

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

STARTUP/SHUTDOWN FILES

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

FILES

358       $ZDOTDIR/.zshenv
359       $ZDOTDIR/.zprofile
360       $ZDOTDIR/.zshrc
361       $ZDOTDIR/.zlogin
362       $ZDOTDIR/.zlogout
363       ${TMPPREFIX}*   (default is /tmp/zsh*)
364       /etc/zshenv
365       /etc/zprofile
366       /etc/zshrc
367       /etc/zlogin
368       /etc/zlogout    (installation-specific - /etc is the default)
369

SEE ALSO

371       sh(1), csh(1), tcsh(1), rc(1), bash(1), ksh(1), zshbuiltins(1), zshcom‐
372       pwid(1), zshcompsys(1), zshcompctl(1), zshexpn(1), zshmisc(1),  zshmod‐
373       ules(1), zshoptions(1), zshparam(1), zshzle(1)
374
375       IEEE  Standard  for  information Technology - Portable Operating System
376       Interface (POSIX) - Part 2: Shell and Utilities, IEEE Inc,  1993,  ISBN
377       1-55937-255-9.
378
379
380
381zsh 4.3.10                       June 1, 2009                           ZSH(1)
Impressum