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       It  does  not  provide  compatibility with POSIX or other shells in its
35       default operating mode:  see the section Compatibility below.
36
37       Zsh has command line editing, builtin spelling correction, programmable
38       command completion, shell functions (with autoloading), a history mech‐
39       anism, and a host of other features.
40

AUTHOR

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

AVAILABILITY

50       Zsh is available from the following HTTP and anonymous FTP site.
51
52       ftp://ftp.zsh.org/pub/
53       https://www.zsh.org/pub/
54       )
55
56       The  up-to-date source code is available via Git from Sourceforge.  See
57       https://sourceforge.net/projects/zsh/  for  details.   A   summary   of
58       instructions  for  the  archive  can  be  found  at  http://zsh.source
59       forge.net/.
60

MAILING LISTS

62       Zsh has 3 mailing lists:
63
64       <zsh-announce@zsh.org>
65              Announcements about releases, major changes in the shell and the
66              monthly posting of the Zsh FAQ.  (moderated)
67
68       <zsh-users@zsh.org>
69              User discussions.
70
71       <zsh-workers@zsh.org>
72              Hacking, development, bug reports and patches.
73
74       To subscribe or unsubscribe, send mail to the associated administrative
75       address for the mailing list.
76
77       <zsh-announce-subscribe@zsh.org>
78       <zsh-users-subscribe@zsh.org>
79       <zsh-workers-subscribe@zsh.org>
80       <zsh-announce-unsubscribe@zsh.org>
81       <zsh-users-unsubscribe@zsh.org>
82       <zsh-workers-unsubscribe@zsh.org>
83
84       YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED.  All
85       submissions  to  zsh-announce are automatically forwarded to zsh-users.
86       All submissions to zsh-users are automatically forwarded  to  zsh-work‐
87       ers.
88
89       If  you  have  problems subscribing/unsubscribing to any of the mailing
90       lists, send mail to <listmaster@zsh.org>.  The mailing lists are  main‐
91       tained by Karsten Thygesen <karthy@kom.auc.dk>.
92
93       The  mailing  lists  are archived; the archives can be accessed via the
94       administrative addresses listed above.  There is also a  hypertext  ar‐
95       chive,   maintained   by   Geoff   Wing   <gcw@zsh.org>,  available  at
96       https://www.zsh.org/mla/.
97

THE ZSH FAQ

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

THE ZSH WEB PAGE

107       Zsh  has  a web page which is located at https://www.zsh.org/.  This is
108       maintained by Karsten Thygesen <karthy@zsh.org>,  of  SunSITE  Denmark.
109       The contact address for web-related matters is <webmaster@zsh.org>.
110

THE ZSH USERGUIDE

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

INVOCATION

121       The following flags are interpreted by the shell when invoked to deter‐
122       mine where the shell will read commands from:
123
124       -c     Take the first argument as a command  to  execute,  rather  than
125              reading  commands  from a script or standard input.  If any fur‐
126              ther arguments are given, the  first  one  is  assigned  to  $0,
127              rather than being used as a positional parameter.
128
129       -i     Force  shell to be interactive.  It is still possible to specify
130              a script to execute.
131
132       -s     Force shell to read commands from the standard input.  If the -s
133              flag is not present and an argument is given, the first argument
134              is taken to be the pathname of a script to execute.
135
136       If there are any remaining arguments after option processing, and  nei‐
137       ther  of the options -c or -s was supplied, the first argument is taken
138       as the file name of a script containing shell commands to be  executed.
139       If  the option PATH_SCRIPT is set, and the file name does not contain a
140       directory path (i.e. there is no `/' in the name),  first  the  current
141       directory  and  then  the  command  path given by the variable PATH are
142       searched for the script.  If the option is not set  or  the  file  name
143       contains a `/' it is used directly.
144
145       After  the  first  one  or  two  arguments  have  been  appropriated as
146       described above, the remaining arguments are assigned to the positional
147       parameters.
148
149       For  further  options,  which  are  common  to  invocation  and the set
150       builtin, see zshoptions(1).
151
152       The long option `--emulate' followed (in a separate word) by an  emula‐
153       tion  mode  may  be passed to the shell.  The emulation modes are those
154       described for the emulate builtin, see zshbuiltins(1).  The `--emulate'
155       option  must  precede any other options (which might otherwise be over‐
156       ridden), but following options are honoured, so may be used  to  modify
157       the  requested emulation mode.  Note that certain extra steps are taken
158       to ensure a smooth emulation when this option is used compared with the
159       emulate  command within the shell: for example, variables that conflict
160       with POSIX usage such as path are not defined within the shell.
161
162       Options may be specified by name using the -o option.  -o acts  like  a
163       single-letter  option, but takes a following string as the option name.
164       For example,
165
166              zsh -x -o shwordsplit scr
167
168       runs the script scr, setting the XTRACE  option  by  the  corresponding
169       letter  `-x'  and  the  SH_WORD_SPLIT  option  by name.  Options may be
170       turned off by name by using +o instead of -o.  -o  can  be  stacked  up
171       with  preceding single-letter options, so for example `-xo shwordsplit'
172       or `-xoshwordsplit' is equivalent to `-x -o shwordsplit'.
173
174       Options may also be  specified  by  name  in  GNU  long  option  style,
175       `--option-name'.   When this is done, `-' characters in the option name
176       are permitted: they are translated into `_', and thus ignored.  So, for
177       example,  `zsh  --sh-word-split'  invokes  zsh  with  the SH_WORD_SPLIT
178       option turned on.  Like other option syntaxes, options  can  be  turned
179       off  by replacing the initial `-' with a `+'; thus `+-sh-word-split' is
180       equivalent to  `--no-sh-word-split'.   Unlike  other  option  syntaxes,
181       GNU-style long options cannot be stacked with any other options, so for
182       example `-x-shwordsplit' is an error, rather than  being  treated  like
183       `-x --shwordsplit'.
184
185       The  special GNU-style option `--version' is handled; it sends to stan‐
186       dard output the shell's version information, then  exits  successfully.
187       `--help' is also handled; it sends to standard output a list of options
188       that can be used when invoking the shell, then exits successfully.
189
190       Option processing may be finished, allowing  following  arguments  that
191       start  with  `-' or `+' to be treated as normal arguments, in two ways.
192       Firstly, a lone `-' (or `+') as an argument by itself ends option  pro‐
193       cessing.  Secondly, a special option `--' (or `+-'), which may be spec‐
194       ified on its own (which is the standard POSIX usage) or may be  stacked
195       with  preceding  options  (so `-x-' is equivalent to `-x --').  Options
196       are not permitted to be stacked after `--' (so `-x-f' is an error), but
197       note  the  GNU-style option form discussed above, where `--shwordsplit'
198       is permitted and does not end option processing.
199
200       Except when the sh/ksh emulation single-letter options are  in  effect,
201       the  option  `-b' (or `+b') ends option processing.  `-b' is like `--',
202       except that further single-letter options can be stacked after the `-b'
203       and will take effect as normal.
204

COMPATIBILITY

206       Zsh  tries to emulate sh or ksh when it is invoked as sh or ksh respec‐
207       tively; more precisely, it looks at the first letter  of  the  name  by
208       which  it  was invoked, excluding any initial `r' (assumed to stand for
209       `restricted'), and if that is `b', `s' or `k' it  will  emulate  sh  or
210       ksh.   Furthermore,  if invoked as su (which happens on certain systems
211       when the shell is executed by the su command), the shell  will  try  to
212       find  an  alternative name from the SHELL environment variable and per‐
213       form emulation based on that.
214
215       In sh and ksh compatibility modes the following parameters are not spe‐
216       cial  and  not  initialized  by the shell: ARGC, argv, cdpath, fignore,
217       fpath, HISTCHARS, mailpath, MANPATH,  manpath,  path,  prompt,  PROMPT,
218       PROMPT2, PROMPT3, PROMPT4, psvar, status, watch.
219
220       The  usual zsh startup/shutdown scripts are not executed.  Login shells
221       source /etc/profile followed by $HOME/.profile.  If the ENV environment
222       variable  is  set  on  invocation,  $ENV  is  sourced after the profile
223       scripts.  The value of ENV is subjected to parameter expansion, command
224       substitution,  and  arithmetic  expansion before being interpreted as a
225       pathname.  Note that the PRIVILEGED option also affects  the  execution
226       of startup files.
227
228       The  following  options  are  set if the shell is invoked as sh or ksh:
229       NO_BAD_PATTERN,   NO_BANG_HIST,   NO_BG_NICE,    NO_EQUALS,    NO_FUNC‐
230       TION_ARGZERO,  GLOB_SUBST,  NO_GLOBAL_EXPORT,  NO_HUP, INTERACTIVE_COM‐
231       MENTS, KSH_ARRAYS, NO_MULTIOS, NO_NOMATCH,  NO_NOTIFY,  POSIX_BUILTINS,
232       NO_PROMPT_PERCENT,    RM_STAR_SILENT,    SH_FILE_EXPANSION,    SH_GLOB,
233       SH_OPTION_LETTERS,  SH_WORD_SPLIT.   Additionally  the   BSD_ECHO   and
234       IGNORE_BRACES  options  are  set  if  zsh  is invoked as sh.  Also, the
235       KSH_OPTION_PRINT, LOCAL_OPTIONS,  PROMPT_BANG,  PROMPT_SUBST  and  SIN‐
236       GLE_LINE_ZLE options are set if zsh is invoked as ksh.
237

RESTRICTED SHELL

239       When  the  basename  of  the command used to invoke zsh starts with the
240       letter `r' or the `-r' command line option is supplied  at  invocation,
241       the  shell  becomes  restricted.   Emulation  mode  is determined after
242       stripping the letter `r' from the invocation name.  The  following  are
243       disabled in restricted mode:
244
245       ·      changing directories with the cd builtin
246
247       ·      changing  or  unsetting the EGID, EUID, GID, HISTFILE, HISTSIZE,
248              IFS,  LD_AOUT_LIBRARY_PATH,  LD_AOUT_PRELOAD,   LD_LIBRARY_PATH,
249              LD_PRELOAD, MODULE_PATH, module_path, PATH, path, SHELL, UID and
250              USERNAME parameters
251
252       ·      specifying command names containing /
253
254       ·      specifying command pathnames using hash
255
256       ·      redirecting output to files
257
258       ·      using the exec builtin command to replace the shell with another
259              command
260
261       ·      using jobs -Z to overwrite the shell process' argument and envi‐
262              ronment space
263
264       ·      using the ARGV0 parameter to override argv[0] for external  com‐
265              mands
266
267       ·      turning off restricted mode with set +r or unsetopt RESTRICTED
268
269       These  restrictions  are  enforced  after processing the startup files.
270       The startup files should set up PATH to point to a  directory  of  com‐
271       mands  which can be safely invoked in the restricted environment.  They
272       may also add further restrictions by disabling selected builtins.
273
274       Restricted  mode  can  also  be  activated  any  time  by  setting  the
275       RESTRICTED  option.   This  immediately  enables  all  the restrictions
276       described above even if the shell still has not processed  all  startup
277       files.
278

STARTUP/SHUTDOWN FILES

280       Commands  are  first  read from /etc/zshenv; this cannot be overridden.
281       Subsequent behaviour is modified by the RCS and GLOBAL_RCS options; the
282       former  affects all startup files, while the second only affects global
283       startup files (those shown here with an path starting with  a  /).   If
284       one  of  the  options  is  unset  at  any point, any subsequent startup
285       file(s) of the corresponding type will not be read.  It is also  possi‐
286       ble  for  a  file  in  $ZDOTDIR  to  re-enable GLOBAL_RCS. Both RCS and
287       GLOBAL_RCS are set by default.
288
289       Commands are then read from $ZDOTDIR/.zshenv.  If the shell is a  login
290       shell,  commands  are  read from /etc/zprofile and then $ZDOTDIR/.zpro‐
291       file.  Then, if the  shell  is  interactive,  commands  are  read  from
292       /etc/zshrc  and then $ZDOTDIR/.zshrc.  Finally, if the shell is a login
293       shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
294
295       When  a  login  shell  exits,  the  files  $ZDOTDIR/.zlogout  and  then
296       /etc/zlogout  are  read.  This happens with either an explicit exit via
297       the exit or logout commands, or an implicit exit by reading end-of-file
298       from  the  terminal.   However, if the shell terminates due to exec'ing
299       another process, the  logout  files  are  not  read.   These  are  also
300       affected  by  the  RCS  and GLOBAL_RCS options.  Note also that the RCS
301       option affects the saving of history files, i.e. if RCS is  unset  when
302       the shell exits, no history file will be saved.
303
304       If ZDOTDIR is unset, HOME is used instead.  Files listed above as being
305       in /etc may be in another directory, depending on the installation.
306
307       As /etc/zshenv is run for all instances of zsh, it is important that it
308       be  kept as small as possible.  In particular, it is a good idea to put
309       code that does not need to be run for every single shell behind a  test
310       of the form `if [[ -o rcs ]]; then ...' so that it will not be executed
311       when zsh is invoked with the `-f' option.
312
313       Any of these files may be pre-compiled with the zcompile  builtin  com‐
314       mand  (see  zshbuiltins(1)).   If a compiled file exists (named for the
315       original file plus the .zwc extension) and it is newer than the  origi‐
316       nal file, the compiled file will be used instead.
317

FILES

319       $ZDOTDIR/.zshenv
320       $ZDOTDIR/.zprofile
321       $ZDOTDIR/.zshrc
322       $ZDOTDIR/.zlogin
323       $ZDOTDIR/.zlogout
324       ${TMPPREFIX}*   (default is /tmp/zsh*)
325       /etc/zshenv
326       /etc/zprofile
327       /etc/zshrc
328       /etc/zlogin
329       /etc/zlogout    (installation-specific - /etc is the default)
330

SEE ALSO

332       sh(1),   csh(1),  tcsh(1),  rc(1),  bash(1),  ksh(1),  zshall(1),  zsh‐
333       builtins(1), zshcalsys(1), zshcompwid(1), zshcompsys(1), zshcompctl(1),
334       zshcontrib(1),  zshexpn(1),  zshmisc(1),  zshmodules(1), zshoptions(1),
335       zshparam(1), zshroadmap(1), zshtcpsys(1), zshzftpsys(1), zshzle(1)
336
337       IEEE Standard for information Technology -  Portable  Operating  System
338       Interface  (POSIX)  - Part 2: Shell and Utilities, IEEE Inc, 1993, ISBN
339       1-55937-255-9.
340
341
342
343zsh 5.7.1                      February 3, 2019                         ZSH(1)
Impressum