GNU.WIKI: The GNU/Linux Knowledge Base

  [HOME] [PHP Manual] [HowTo] [ABS] [MAN1] [MAN2] [MAN3] [MAN4] [MAN5] [MAN6] [MAN7] [MAN8] [MAN9]

  [0-9] [Aa] [Bb] [Cc] [Dd] [Ee] [Ff] [Gg] [Hh] [Ii] [Jj] [Kk] [Ll] [Mm] [Nn] [Oo] [Pp] [Qq] [Rr] [Ss] [Tt] [Uu] [Vv] [Ww] [Xx] [Yy] [Zz]


       zshall - the Z shell meta-man page


       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:

       zshroadmap   Informal introduction to the manual
       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
       zshcalsys    Zsh built-in calendar functions
       zshtcpsys    Zsh built-in TCP functions
       zshzftpsys   Zsh built-in FTP client
       zshcontrib   Additional zsh functions and utilities


       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 ksh 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.


       Zsh was originally written by Paul Falstad <>.   Zsh  is  now
       maintained   by   the   members   of   the   zsh-workers  mailing  list
       <>.  The development  is  currently  coordinated  by
       Peter  Stephenson  <>.   The coordinator can be contacted at
       <>,  but  matters  relating  to  the   code   should
       generally go to the mailing list.


       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 instead of the primary site.

       Primary site



       The  up-to-date source code is available via anonymous CVS and Git from
       Sourceforge.  See for details.   A
       summary  of  instructions  for the CVS and Git archives can be found at


       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.


       submissions  to  zsh-announce are automatically forwarded to zsh-users.
       All  submissions  to   zsh-users   are   automatically   forwarded   to

       If  you  have  problems subscribing/unsubscribing to any of the mailing
       lists, send  mail  to  <>.   The  mailing  lists  are
       maintained by Karsten Thygesen <>.

       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  <>,  available  at


       Zsh has a list of Frequently Asked Questions (FAQ), maintained by Peter
       Stephenson  <>.   It  is  regularly  posted to the newsgroup and the zsh-announce mailing list.  The latest  version
       can    be    found   at   any   of   the   Zsh   FTP   sites,   or   at  The contact address for  FAQ-related  matters
       is <>.


       Zsh  has  a  web page which is located at  This is
       maintained by Karsten Thygesen <>,  of  SunSITE  Denmark.
       The contact address for web-related matters is <>.


       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   At the time of writing,
       chapters dealing with startup files and  their  contents  and  the  new
       completion system were essentially complete.


       A  `wiki'  website for zsh has been created at
       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


       The following flags are  interpreted  by  the  shell  when  invoked  to
       determine where the shell will read commands from:

       -c     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 $0,
              rather than being used as a positional parameter.

       -i     Force shell to be interactive.  It is still possible to  specify
              a script to execute.

       -s     Force shell to read commands from the standard input.  If the -s
              flag is not present and an argument is given, the first argument
              is taken to be the pathname of a script to execute.

       If  there  are  any  remaining  arguments  after option processing, and
       neither of the options -c or -s was supplied,  the  first  argument  is
       taken  as  the  file  name  of a script containing shell commands to be
       executed.  If the option PATH_SCRIPT is set, and the file name does not
       contain  a directory path (i.e. there is no `/' in the name), first the
       current directory and then the command path given by the variable  PATH
       are searched for the script.  If the option is not set or the file name
       contains a `/' it is used directly.

       After the  first  one  or  two  arguments  have  been  appropriated  as
       described above, the remaining arguments are assigned to the positional

       For further options,  which  are  common  to  invocation  and  the  set
       builtin, see zshoptions(1).

       Options  may  be specified by name using the -o option.  -o acts like a
       single-letter option, but takes a following string as the option  name.
       For example,

              zsh -x -o shwordsplit scr

       runs  the  script  scr,  setting the XTRACE option by the corresponding
       letter `-x' and the SH_WORD_SPLIT  option  by  name.   Options  may  be
       turned  off  by  name  by using +o instead of -o.  -o can be stacked up
       with preceding single-letter options, so for example `-xo  shwordsplit'
       or `-xoshwordsplit' is equivalent to `-x -o shwordsplit'.

       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, for
       example, `zsh  --sh-word-split'  invokes  zsh  with  the  SH_WORD_SPLIT
       option  turned  on.   Like other option syntaxes, options can be turned
       off by replacing the initial `-' with a `+'; thus `+-sh-word-split'  is
       equivalent  to  `--no-sh-word-split'.   Unlike  other  option syntaxes,
       GNU-style long options cannot be stacked with any other options, so for
       example  `-x-shwordsplit'  is  an error, rather than being treated like
       `-x --shwordsplit'.

       The special GNU-style  option  `--version'  is  handled;  it  sends  to
       standard   output   the   shell's   version   information,  then  exits
       successfully.  `--help' is also handled; it sends to standard output  a
       list  of  options  that can be used when invoking the shell, then exits

       Option processing may be finished, allowing  following  arguments  that
       start  with  `-' or `+' to be treated as normal arguments, in two ways.
       Firstly, a lone `-' (or `+') as  an  argument  by  itself  ends  option
       processing.   Secondly,  a  special option `--' (or `+-'), which may be
       specified on its own (which is the standard  POSIX  usage)  or  may  be
       stacked  with  preceding  options  (so `-x-' is equivalent to `-x --').
       Options are not permitted to be stacked after `--'  (so  `-x-f'  is  an
       error),  but  note  the  GNU-style  option  form discussed above, where
       `--shwordsplit' is permitted and does not end option processing.

       Except when the sh/ksh emulation single-letter options are  in  effect,
       the  option  `-b' (or `+b') ends option processing.  `-b' is like `--',
       except that further single-letter options can be stacked after the `-b'
       and will take effect as normal.


       Zsh  tries  to  emulate  sh  or  ksh  when  it  is invoked as sh or ksh
       respectively; more precisely, it looks at the first letter of the  name
       by  which  it  was invoked, excluding any initial `r' (assumed to stand
       for `restricted'), and if that is `s' or `k' it will emulate sh or ksh.
       Furthermore,  if  invoked  as su (which happens on certain systems when
       the shell is executed by the su command), the shell will try to find an
       alternative  name  from  the  SHELL  environment  variable  and perform
       emulation based on that.

       In sh and ksh compatibility modes  the  following  parameters  are  not
       special  and not initialized by the shell: ARGC, argv, cdpath, fignore,
       fpath, HISTCHARS, mailpath, MANPATH,  manpath,  path,  prompt,  PROMPT,
       PROMPT2, PROMPT3, PROMPT4, psvar, status, watch.

       The  usual zsh startup/shutdown scripts are not executed.  Login shells
       source /etc/profile followed by $HOME/.profile.  If the ENV environment
       variable  is  set  on  invocation,  $ENV  is  sourced after the profile
       scripts.  The value of ENV is subjected to parameter expansion, command
       substitution,  and  arithmetic  expansion before being interpreted as a
       pathname.  Note that the PRIVILEGED option also affects  the  execution
       of startup files.

       The  following  options  are  set if the shell is invoked as sh or ksh:
       NO_BAD_PATTERN,       NO_BANG_HIST,       NO_BG_NICE,        NO_EQUALS,
       and  IGNORE_BRACES  options are set if zsh is invoked as sh.  Also, the
       SINGLE_LINE_ZLE options are set if zsh is invoked as ksh.


       When  the  basename  of  the command used to invoke zsh starts with the
       letter `r' or the `-r' command line option is supplied  at  invocation,
       the  shell  becomes  restricted.   Emulation  mode  is determined after
       stripping the letter `r' from the invocation name.  The  following  are
       disabled in restricted mode:

       ·      changing directories with the cd builtin

       ·      changing  or unsetting the PATH, path, MODULE_PATH, module_path,
              LD_LIBRARY_PATH,     LD_AOUT_LIBRARY_PATH,     LD_PRELOAD    and
              LD_AOUT_PRELOAD parameters

       ·      specifying command names containing /

       ·      specifying command pathnames using hash

       ·      redirecting output to files

       ·      using the exec builtin command to replace the shell with another

       ·      using  jobs  -Z  to  overwrite  the  shell process' argument and
              environment space

       ·      using the ARGV0  parameter  to  override  argv[0]  for  external

       ·      turning off restricted mode with set +r or unsetopt RESTRICTED

       These  restrictions  are  enforced  after processing the startup files.
       The startup files should set  up  PATH  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.

       Restricted  mode  can  also  be  activated  any  time  by  setting  the
       RESTRICTED  option.   This  immediately  enables  all  the restrictions
       described above even if the shell still has not processed  all  startup


       Commands  are  first  read from /etc/zshenv; this cannot be overridden.
       Subsequent behaviour is modified by the RCS and GLOBAL_RCS options; the
       former  affects all startup files, while the second only affects global
       startup files (those shown here with an path starting with  a  /).   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 $ZDOTDIR to re-enable GLOBAL_RCS. Both RCS and
       GLOBAL_RCS are set by default.

       Commands are then read from $ZDOTDIR/.zshenv.  If the shell is a  login
       shell,    commands    are    read    from    /etc/zprofile   and   then
       $ZDOTDIR/.zprofile.  Then, if the shell is  interactive,  commands  are
       read  from  /etc/zshrc and then $ZDOTDIR/.zshrc.  Finally, if the shell
       is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.

       When  a  login  shell  exits,  the  files  $ZDOTDIR/.zlogout  and  then
       /etc/zlogout  are  read.  This happens with either an explicit exit via
       the exit or logout commands, or an implicit exit by reading end-of-file
       from  the  terminal.   However, if the shell terminates due to exec'ing
       another process, the  logout  files  are  not  read.   These  are  also
       affected  by  the  RCS  and GLOBAL_RCS options.  Note also that the RCS
       option affects the saving of history files, i.e. if RCS is  unset  when
       the shell exits, no history file will be saved.

       If ZDOTDIR is unset, HOME is used instead.  Files listed above as being
       in /etc may be in another directory, depending on the installation.

       As /etc/zshenv 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 `if [[ -o rcs ]]; then ...' so that it will not be executed
       when zsh is invoked with the `-f' option.

       Any of these files  may  be  pre-compiled  with  the  zcompile  builtin
       command (see zshbuiltins(1)).  If a compiled file exists (named for the
       original file plus the  .zwc  extension)  and  it  is  newer  than  the
       original file, the compiled file will be used instead.


       zshroadmap - informal introduction to the zsh manual

       The  Zsh Manual, like the shell itself, is large and often complicated.
       This section of the manual provides some pointers to areas of the shell
       that  are  likely  to  be  of  particular  interest  to  new users, and
       indicates where in the rest of the manual the documentation  is  to  be


       When it starts, the shell reads commands from various files.  These can
       be  created  or  edited  to  customize  the  shell.   See  the  section
       Startup/Shutdown Files in zsh(1).

       If  no  personal  initialization  files  exist  for the current user, a
       function is run to help you change some of the  most  common  settings.
       It  won't  appear  if  your  administrator has disabled the zsh/newuser
       module.  The function is designed to be self-explanatory.  You can  run
       it  by hand with `autoload -Uz zsh-newuser-install; zsh-newuser-install
       -f'.   See  also  the   section   User   Configuration   Functions   in


       Interaction with the shell uses the builtin Zsh Line Editor, ZLE.  This
       is described in detail in zshzle(1).

       The first decision a user must make is whether to use the Emacs  or  Vi
       editing  mode  as  the  keys  for  editing are substantially different.
       Emacs editing mode is probably more natural for beginners  and  can  be
       selected explicitly with the command bindkey -e.

       A  history mechanism for retrieving previously typed lines (most simply
       with the Up or Down arrow keys) is available; note that,  unlike  other
       shells,  zsh  will not save these lines when the shell exits unless you
       set appropriate variables, and the number of history lines retained  by
       default  is  quite  small (30 lines).  See the description of the shell
       variables (referred to in the documentation  as  parameters)  HISTFILE,
       HISTSIZE and SAVEHIST in zshparam(1).

       The  shell  now  supports  the  UTF-8 character set (and also others if
       supported  by  the  operating  system).   This  is   (mostly)   handled
       transparently  by  the  shell,  but  the  degree of support in terminal
       emulators is variable.  There is some discussion of this in  the  shell
       FAQ,   .   Note  in  particular  that  for
       combining characters to be handled the option COMBINING_CHARS needs  to
       be  set.   Because the shell is now more sensitive to the definition of
       the character set, note that if you are upgrading from an older version
       of  the  shell  you should ensure that the appropriate variable, either
       LANG (to affect all aspects of the shell's operation) or  LC_CTYPE  (to
       affect  only  the  handling of character sets) is set to an appropriate
       value.  This is true even if you are using a single-byte character  set
       including  extensions  of ASCII such as ISO-8859-1 or ISO-8859-15.  See
       the description of LC_CTYPE in zshparam(1).

       Completion is a feature present in many shells. It allows the  user  to
       type only a part (usually the prefix) of a word and have the shell fill
       in the rest.  The  completion  system  in  zsh  is  programmable.   For
       example,  the shell can be set to complete email addresses in arguments
       to  the  mail  command  from  your   ~/.abook/addressbook;   usernames,
       hostnames,  and  even  remote  paths  in  arguments  to scp, and so on.
       Anything that can be written in or glued together with zsh can  be  the
       source of what the line editor offers as possible completions.

       Zsh  has  two  completion systems, an old, so called compctl completion
       (named after the builtin command that serves as its complete  and  only
       user  interface),  and  a new one, referred to as compsys, organized as
       library of builtin and user-defined functions.  The two systems  differ
       in  their  interface  for  specifying the completion behavior.  The new
       system is more customizable and is supplied with completions  for  many
       commonly used commands; it is therefore to be preferred.

       The completion system must be enabled explicitly when the shell starts.
       For more information see zshcompsys(1).

   Extending the line editor
       Apart from completion, the line editor is highly extensible by means of
       shell  functions.   Some  useful functions are provided with the shell;
       they provide facilities such as:

              composing characters not found on the keyboard

              configuring what the line editor considers a word when moving or
              deleting by word

       history-beginning-search-backward-end, etc.
              alternative ways of searching the shell history

       replace-string, replace-pattern
              functions  for  replacing  strings  or  patterns globally in the
              command line

              edit the command line with an external editor.

       See the section `ZLE Functions' in zshcontrib(1)  for  descriptions  of


       The  shell  has  a  large number of options for changing its behaviour.
       These cover all aspects of the shell; browsing the  full  documentation
       is  the only good way to become acquainted with the many possibilities.
       See zshoptions(1).


       The shell has a rich set of  patterns  which  are  available  for  file
       matching  (described  in the documentation as `filename generation' and
       also known for historical reasons  as  `globbing')  and  for  use  when
       programming.   These are described in the section `Filename Generation'
       in zshexpn(1).

       Of particular interest are the following patterns that are not commonly
       supported by other systems of pattern matching:

       **     for matching over multiple directories

       ~, ^   the   ability   to  exclude  patterns  from  matching  when  the
              EXTENDED_GLOB option is set

       (...)  glob qualifiers, included in  parentheses  at  the  end  of  the
              pattern,  which  select  files  by type (such as directories) or
              attribute (such as size).


       Although the syntax of zsh is in ways similar to the  Korn  shell,  and
       therefore  more  remotely to the original UNIX shell, the Bourne shell,
       its default behaviour does not entirely  correspond  to  those  shells.
       General  shell  syntax  is introduced in the section `Shell Grammar' in

       One commonly encountered difference is that variables substituted  onto
       the  command line are not split into words.  See the description of the
       shell option SH_WORD_SPLIT in  the  section  `Parameter  Expansion'  in
       zshexpn(1).   In  zsh,  you can either explicitly request the splitting
       (e.g. ${=foo}) or use an array when you want a variable  to  expand  to
       more than one word.  See the section `Array Parameters' in zshparam(1).


       The  most  convenient  way  of  adding  enhancements  to  the  shell is
       typically by writing a shell  function  and  arranging  for  it  to  be
       autoloaded.   Functions  are  described  in  the section `Functions' in
       zshmisc(1).  Users changing from the C shell and its  relatives  should
       notice that aliases are less used in zsh as they don't perform argument
       substitution, only simple text replacement.

       A few general functions, other than those for the line editor described
       above,  are provided with the shell and are described in zshcontrib(1).
       Features include:

              a prompt theme system  for  changing  prompts  easily,  see  the
              section `Prompt Themes'

              a  MIME-handling  system  which dispatches commands according to
              the suffix of a file as done by graphical file managers

       zcalc  a calculator

       zargs  a version of xargs that makes the find command redundant

       zmv    a command for renaming files by means of shell patterns.


       ${TMPPREFIX}*   (default is /tmp/zsh*)
       /etc/zlogout    (installation-specific - /etc is the default)


       sh(1), csh(1), tcsh(1), rc(1), bash(1), ksh(1)

       IEEE Standard for information Technology -  Portable  Operating  System
       Interface  (POSIX)  - Part 2: Shell and Utilities, IEEE Inc, 1993, ISBN

  All copyrights belong to their respective owners. Other content (c) 2014-2018, GNU.WIKI. Please report site errors to
Page load time: 0.113 seconds. Last modified: November 04 2018 12:49:43.