{
    "mode": "man",
    "parameter": "ZSH",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ZSH/1/json",
    "generated": "2026-06-10T15:29:43Z",
    "sections": {
        "NAME": {
            "content": "zsh - the Z shell\n",
            "subsections": []
        },
        "OVERVIEW": {
            "content": "Because zsh contains many features, the zsh manual has been split into a number of sections:\n\nzsh          Zsh overview (this section)\nzshroadmap   Informal introduction to the manual\nzshmisc      Anything not fitting into the other sections\nzshexpn      Zsh command and parameter expansion\nzshparam     Zsh parameters\nzshoptions   Zsh options\nzshbuiltins  Zsh built-in functions\nzshzle       Zsh command line editing\nzshcompwid   Zsh completion widgets\nzshcompsys   Zsh completion system\nzshcompctl   Zsh completion control\nzshmodules   Zsh loadable modules\nzshcalsys    Zsh built-in calendar functions\nzshtcpsys    Zsh built-in TCP functions\nzshzftpsys   Zsh built-in FTP client\nzshcontrib   Additional zsh functions and utilities\nzshall       Meta-man page containing all of the above\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Zsh is a UNIX command interpreter (shell) usable as an interactive login shell and as a shell\nscript command processor.  Of the standard shells, zsh most closely  resembles  ksh  but  in‐\ncludes  many  enhancements.   It does not provide compatibility with POSIX or other shells in\nits default operating mode:  see the section Compatibility below.\n\nZsh has command line editing, builtin spelling correction, programmable  command  completion,\nshell functions (with autoloading), a history mechanism, and a host of other features.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Zsh  was  originally written by Paul Falstad <pf@zsh.org>.  Zsh is now maintained by the mem‐\nbers of the zsh-workers mailing list <zsh-workers@zsh.org>.  The development is currently co‐\nordinated  by Peter Stephenson <pws@zsh.org>.  The coordinator can be contacted at <coordina‐‐\ntor@zsh.org>, but matters relating to the code should generally go to the mailing list.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "Zsh is available from the following HTTP and anonymous FTP site.\n",
            "subsections": [
                {
                    "name": "ftp://ftp.zsh.org/pub/",
                    "content": ""
                },
                {
                    "name": "https://www.zsh.org/pub/",
                    "content": ")\n\nThe up-to-date source code is  available  via  Git  from  Sourceforge.   See  https://source‐‐\nforge.net/projects/zsh/  for details.  A summary of instructions for the archive can be found\nat http://zsh.sourceforge.net/.\n"
                }
            ]
        },
        "MAILING LISTS": {
            "content": "Zsh has 3 mailing lists:\n",
            "subsections": [
                {
                    "name": "<zsh-announce@zsh.org>",
                    "content": "Announcements about releases, major changes in the shell and the  monthly  posting  of\nthe Zsh FAQ.  (moderated)\n"
                },
                {
                    "name": "<zsh-users@zsh.org>",
                    "content": "User discussions.\n"
                },
                {
                    "name": "<zsh-workers@zsh.org>",
                    "content": "Hacking, development, bug reports and patches.\n\nTo subscribe or unsubscribe, send mail to the associated administrative address for the mail‐\ning list.\n"
                },
                {
                    "name": "<zsh-announce-subscribe@zsh.org>",
                    "content": ""
                },
                {
                    "name": "<zsh-users-subscribe@zsh.org>",
                    "content": ""
                },
                {
                    "name": "<zsh-workers-subscribe@zsh.org>",
                    "content": ""
                },
                {
                    "name": "<zsh-announce-unsubscribe@zsh.org>",
                    "content": ""
                },
                {
                    "name": "<zsh-users-unsubscribe@zsh.org>",
                    "content": ""
                },
                {
                    "name": "<zsh-workers-unsubscribe@zsh.org>",
                    "content": "YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS  AS  THEY  ARE  NESTED.   All  submissions  to\nzsh-announce  are automatically forwarded to zsh-users.  All submissions to zsh-users are au‐\ntomatically forwarded to zsh-workers.\n\nIf you have problems subscribing/unsubscribing to any of the  mailing  lists,  send  mail  to\n<listmaster@zsh.org>.     The    mailing   lists   are   maintained   by   Karsten   Thygesen\n<karthy@kom.auc.dk>.\n\nThe mailing lists are archived; the archives can be accessed via the administrative addresses\nlisted  above.   There  is  also a hypertext archive, maintained by Geoff Wing <gcw@zsh.org>,\navailable at https://www.zsh.org/mla/.\n"
                }
            ]
        },
        "THE ZSH FAQ": {
            "content": "Zsh has  a  list  of  Frequently  Asked  Questions  (FAQ),  maintained  by  Peter  Stephenson\n<pws@zsh.org>.   It is regularly posted to the newsgroup comp.unix.shell and the zsh-announce\nmailing list.  The latest version  can  be  found  at  any  of  the  Zsh  FTP  sites,  or  at\nhttp://www.zsh.org/FAQ/.  The contact address for FAQ-related matters is <faqmaster@zsh.org>.\n",
            "subsections": []
        },
        "THE ZSH WEB PAGE": {
            "content": "Zsh  has  a web page which is located at https://www.zsh.org/.  This is maintained by Karsten\nThygesen <karthy@zsh.org>, of SunSITE Denmark.  The contact address for  web-related  matters\nis <webmaster@zsh.org>.\n",
            "subsections": []
        },
        "THE ZSH USERGUIDE": {
            "content": "A  userguide  is currently in preparation.  It is intended to complement the manual, with ex‐\nplanations and hints on issues where the manual can be cabbalistic,  hierographic,  or  down‐\nright  mystifying (for example, the word `hierographic' does not exist).  It can be viewed in\nits current state at http://zsh.sourceforge.net/Guide/.  At the  time  of  writing,  chapters\ndealing  with startup files and their contents and the new completion system were essentially\ncomplete.\n",
            "subsections": []
        },
        "INVOCATION": {
            "content": "The following flags are interpreted by the shell when invoked to determine  where  the  shell\nwill read commands from:\n",
            "subsections": [
                {
                    "name": "-c",
                    "content": "script or standard input.  If any further arguments are given, the first  one  is  as‐\nsigned to $0, rather than being used as a positional parameter.\n",
                    "flag": "-c"
                },
                {
                    "name": "-i",
                    "content": "",
                    "flag": "-i"
                },
                {
                    "name": "-s -s",
                    "content": "and an argument is given, the first argument is taken to be the pathname of  a  script\nto execute.\n\nIf  there  are any remaining arguments after option processing, and neither of the options -c\nor -s was supplied, the first argument is taken as the file name of a script containing shell\ncommands  to  be executed.  If the option PATHSCRIPT is set, and the file name does not con‐\ntain a directory path (i.e. there is no `/' in the name), first  the  current  directory  and\nthen  the command path given by the variable PATH are searched for the script.  If the option\nis not set or the file name contains a `/' it is used directly.\n\nAfter the first one or two arguments have been appropriated as described above, the remaining\narguments are assigned to the positional parameters.\n\nFor further options, which are common to invocation and the set builtin, see zshoptions(1).\n\nThe  long option `--emulate' followed (in a separate word) by an emulation mode may be passed\nto the shell.  The emulation modes are those described for  the  emulate  builtin,  see  zsh‐\nbuiltins(1).  The `--emulate' option must precede any other options (which might otherwise be\noverridden), but following options are honoured, so may be used to modify the requested  emu‐\nlation  mode.  Note that certain extra steps are taken to ensure a smooth emulation when this\noption is used compared with the emulate command within the  shell:  for  example,  variables\nthat conflict with POSIX usage such as path are not defined within the shell.\n\nOptions  may  be specified by name using the -o option.  -o acts like a single-letter option,\nbut takes a following string as the option name.  For example,\n\nzsh -x -o shwordsplit scr\n\nruns the script scr, setting the XTRACE option by  the  corresponding  letter  `-x'  and  the\nSHWORDSPLIT  option  by name.  Options may be turned off by name by using +o instead of -o.",
                    "flag": "-s"
                },
                {
                    "name": "-o -xo",
                    "content": "or `-xoshwordsplit' is equivalent to `-x -o shwordsplit'.\n\nOptions  may  also be specified by name in GNU long option style, `--option-name'.  When this\nis done, `-' characters in the option name are permitted: they are translated into  `',  and\nthus  ignored.  So, for example, `zsh --sh-word-split' invokes zsh with the SHWORDSPLIT op‐\ntion turned on.  Like other option syntaxes, options can be turned off by replacing the  ini‐\ntial  `-'  with  a `+'; thus `+-sh-word-split' is equivalent to `--no-sh-word-split'.  Unlike\nother option syntaxes, GNU-style long options cannot be stacked with any  other  options,  so\nfor example `-x-shwordsplit' is an error, rather than being treated like `-x --shwordsplit'.\n\nThe  special GNU-style option `--version' is handled; it sends to standard output the shell's\nversion information, then exits successfully.  `--help' is also handled; it sends to standard\noutput a list of options that can be used when invoking the shell, then exits successfully.\n\nOption processing may be finished, allowing following arguments that start with `-' or `+' to\nbe treated as normal arguments, in two ways.  Firstly, a lone `-' (or `+') as an argument  by\nitself ends option processing.  Secondly, a special option `--' (or `+-'), which may be spec‐\nified on its own (which is the standard POSIX usage) or may be stacked with preceding options\n(so  `-x-' is equivalent to `-x --').  Options are not permitted to be stacked after `--' (so\n`-x-f' is an error), but note the GNU-style option form  discussed  above,  where  `--shword‐‐\nsplit' is permitted and does not end option processing.\n\nExcept  when  the  sh/ksh  emulation single-letter options are in effect, the option `-b' (or\n`+b') ends option processing.  `-b' is like `--', except that further  single-letter  options\ncan be stacked after the `-b' and will take effect as normal.\n",
                    "flag": "-o"
                }
            ]
        },
        "COMPATIBILITY": {
            "content": "Zsh  tries to emulate sh or ksh when it is invoked as sh or ksh respectively; more precisely,\nit looks at the first letter of the name by which it was invoked, excluding any  initial  `r'\n(assumed  to  stand  for  `restricted'), and if that is `b', `s' or `k' it will emulate sh or\nksh.  Furthermore, if invoked as su (which happens on certain systems when the shell is  exe‐\ncuted by the su command), the shell will try to find an alternative name from the SHELL envi‐\nronment variable and perform emulation based on that.\n\nIn sh and ksh compatibility modes the following parameters are not special and  not  initial‐\nized by the shell: ARGC, argv, cdpath, fignore, fpath, HISTCHARS, mailpath, MANPATH, manpath,\npath, prompt, PROMPT, PROMPT2, PROMPT3, PROMPT4, psvar, status, watch.\n\nThe usual zsh startup/shutdown scripts are not executed.  Login  shells  source  /etc/profile\nfollowed  by  $HOME/.profile.   If the ENV environment variable is set on invocation, $ENV is\nsourced after the profile scripts.  The value of ENV is  subjected  to  parameter  expansion,\ncommand  substitution, and arithmetic expansion before being interpreted as a pathname.  Note\nthat the PRIVILEGED option also affects the execution of startup files.\n\nThe following options are set  if  the  shell  is  invoked  as  sh  or  ksh:  NOBADPATTERN,\nNOBANGHIST,   NOBGNICE,  NOEQUALS,  NOFUNCTIONARGZERO,  GLOBSUBST,  NOGLOBALEXPORT,\nNOHUP, INTERACTIVECOMMENTS, KSHARRAYS, NOMULTIOS, NONOMATCH, NONOTIFY,  POSIXBUILTINS,\nNOPROMPTPERCENT,    RMSTARSILENT,    SHFILEEXPANSION,    SHGLOB,    SHOPTIONLETTERS,\nSHWORDSPLIT.  Additionally the BSDECHO and IGNOREBRACES options are set if zsh is invoked\nas  sh.   Also,  the  KSHOPTIONPRINT,  LOCALOPTIONS,  PROMPTBANG,  PROMPTSUBST  and SIN‐‐\nGLELINEZLE options are set if zsh is invoked as ksh.\n",
            "subsections": []
        },
        "RESTRICTED SHELL": {
            "content": "When the basename of the command used to invoke zsh starts with the letter `r'  or  the  `-r'\ncommand  line option is supplied at invocation, the shell becomes restricted.  Emulation mode\nis determined after stripping the letter `r' from the invocation  name.   The  following  are\ndisabled in restricted mode:\n\n•      changing directories with the cd builtin\n\n•      changing  or  unsetting  the  EGID,  EUID,  GID,  HISTFILE, HISTSIZE, IFS, LDAOUTLI‐‐\nBRARYPATH, LDAOUTPRELOAD, LDLIBRARYPATH,  LDPRELOAD,  MODULEPATH,  modulepath,\nPATH, path, SHELL, UID and USERNAME parameters\n\n•      specifying command names containing /\n\n•      specifying command pathnames using hash\n\n•      redirecting output to files\n\n•      using the exec builtin command to replace the shell with another command\n\n•      using jobs -Z to overwrite the shell process' argument and environment space\n\n•      using the ARGV0 parameter to override argv[0] for external commands\n\n•      turning off restricted mode with set +r or unsetopt RESTRICTED\n\nThese restrictions are enforced after processing the startup files.  The startup files should\nset up PATH to point to a directory of commands which can be safely invoked in the restricted\nenvironment.  They may also add further restrictions by disabling selected builtins.\n\nRestricted  mode can also be activated any time by setting the RESTRICTED option.  This imme‐\ndiately enables all the restrictions described above even if the shell  still  has  not  pro‐\ncessed all startup files.\n\nA  shell  Restricted  Mode  is an outdated way to restrict what users may do:  modern systems\nhave better, safer and more reliable ways to confine user actions, such as chroot jails, con‐\ntainers and zones.\n\nA  restricted  shell  is very difficult to implement safely.  The feature may be removed in a\nfuture version of zsh.\n\nIt is important to realise that the restrictions only apply to the shell, not to the commands\nit  runs  (except  for  some  shell builtins).  While a restricted shell can only run the re‐\nstricted list of commands accessible via the predefined `PATH' variable, it does not  prevent\nthose commands from running any other command.\n\nAs an example, if `env' is among the list of allowed commands, then it allows the user to run\nany command as `env' is not a shell builtin command and can run arbitrary executables.\n\nSo when implementing a restricted shell framework it is important to be fully aware  of  what\nactions  each of the allowed commands or features (which may be regarded as modules) can per‐\nform.\n\nMany commands can have their behaviour affected by environment variables.  Except for the few\nlisted above, zsh does not restrict the setting of environment variables.\n\nIf  a  `perl',  `python', `bash', or other general purpose interpreted script it treated as a\nrestricted command, the user can work around the restriction  by  setting  specially  crafted\n`PERL5LIB', `PYTHONPATH', `BASHENV' (etc.) environment variables. On GNU systems, any command\ncan be made to run arbitrary code when performing character set conversion (including zsh it‐\nself) by setting a `GCONVPATH' environment variable.  Those are only a few examples.\n\nBear in mind that, contrary to some other shells, `readonly' is not a security feature in zsh\nas it can be undone and so cannot be used to mitigate the above.\n\nA restricted shell only works if the allowed commands are few and carefully written so as not\nto  grant more access to users than intended.  It is also important to restrict what zsh mod‐\nule the user may load as some of them, such as `zsh/system', `zsh/mapfile'  and  `zsh/files',\nallow bypassing most of the restrictions.\n",
            "subsections": []
        },
        "STARTUP/SHUTDOWN FILES": {
            "content": "Commands  are  first read from /etc/zsh/zshenv; this cannot be overridden.  Subsequent behav‐\niour is modified by the RCS and GLOBALRCS options; the former  affects  all  startup  files,\nwhile  the  second  only affects global startup files (those shown here with an path starting\nwith a /).  If one of the options is unset at any point, any subsequent  startup  file(s)  of\nthe  corresponding  type  will  not  be  read.  It is also possible for a file in $ZDOTDIR to\nre-enable GLOBALRCS. Both RCS and GLOBALRCS are set by default.\n\nCommands are then read from $ZDOTDIR/.zshenv.  If the shell is a login  shell,  commands  are\nread  from /etc/zsh/zprofile and then $ZDOTDIR/.zprofile.  Then, if the shell is interactive,\ncommands are read from /etc/zsh/zshrc and then $ZDOTDIR/.zshrc.  Finally, if the shell  is  a\nlogin shell, /etc/zsh/zlogin and $ZDOTDIR/.zlogin are read.\n\nWhen  a  login  shell  exits, the files $ZDOTDIR/.zlogout and then /etc/zsh/zlogout are read.\nThis happens with either an explicit exit via the exit or logout  commands,  or  an  implicit\nexit  by  reading  end-of-file  from  the  terminal.  However, if the shell terminates due to\nexec'ing another process, the logout files are not read.  These are also affected by the  RCS\nand  GLOBALRCS  options.  Note also that the RCS option affects the saving of history files,\ni.e. if RCS is unset when the shell exits, no history file will be saved.\n\nIf ZDOTDIR is unset, HOME is used instead.  Files listed above as being in /etc may be in an‐\nother directory, depending on the installation.\n\nAs  /etc/zsh/zshenv is run for all instances of zsh, it is important that it be kept as small\nas possible.  In particular, it is a good idea to put code that does not need to be  run  for\nevery  single shell behind a test of the form `if [[ -o rcs ]]; then ...' so that it will not\nbe executed when zsh is invoked with the `-f' option.\n\nAny of these  files  may  be  pre-compiled  with  the  zcompile  builtin  command  (see  zsh‐\nbuiltins(1)).   If  a  compiled file exists (named for the original file plus the .zwc exten‐\nsion) and it is newer than the original file, the compiled file will be used instead.\n",
            "subsections": []
        },
        "FILES": {
            "content": "",
            "subsections": [
                {
                    "name": "$ZDOTDIR/.zshenv",
                    "content": ""
                },
                {
                    "name": "$ZDOTDIR/.zprofile",
                    "content": ""
                },
                {
                    "name": "$ZDOTDIR/.zshrc",
                    "content": ""
                },
                {
                    "name": "$ZDOTDIR/.zlogin",
                    "content": ""
                },
                {
                    "name": "$ZDOTDIR/.zlogout",
                    "content": "${TMPPREFIX}*   (default is /tmp/zsh*)"
                },
                {
                    "name": "/etc/zsh/zshenv",
                    "content": ""
                },
                {
                    "name": "/etc/zsh/zprofile",
                    "content": ""
                },
                {
                    "name": "/etc/zsh/zshrc",
                    "content": ""
                },
                {
                    "name": "/etc/zsh/zlogin",
                    "content": "/etc/zsh/zlogout    (installation-specific - /etc is the default)\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "sh(1), csh(1), tcsh(1), rc(1), bash(1), ksh(1), zshall(1), zshbuiltins(1), zshcalsys(1), zsh‐\ncompwid(1),  zshcompsys(1),  zshcompctl(1),  zshcontrib(1),  zshexpn(1),  zshmisc(1), zshmod‐\nules(1), zshoptions(1), zshparam(1), zshroadmap(1), zshtcpsys(1), zshzftpsys(1), zshzle(1)\n",
            "subsections": [
                {
                    "name": "IEEE Standard for information Technology - Portable Operating System Interface (POSIX) - Part",
                    "content": "2: Shell and Utilities, IEEE Inc, 1993, ISBN 1-55937-255-9.\n\n\n\nzsh 5.8.1                                 February 12, 2022                                   ZSH(1)"
                }
            ]
        }
    },
    "summary": "zsh - the Z shell",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "sh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/sh/1/json"
        },
        {
            "name": "csh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/csh/1/json"
        },
        {
            "name": "tcsh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/tcsh/1/json"
        },
        {
            "name": "rc",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rc/1/json"
        },
        {
            "name": "bash",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/bash/1/json"
        },
        {
            "name": "ksh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ksh/1/json"
        },
        {
            "name": "zshall",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshall/1/json"
        },
        {
            "name": "zshbuiltins",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshbuiltins/1/json"
        },
        {
            "name": "zshcalsys",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshcalsys/1/json"
        },
        {
            "name": "compwid",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/compwid/1/json"
        },
        {
            "name": "zshcompsys",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshcompsys/1/json"
        },
        {
            "name": "zshcompctl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshcompctl/1/json"
        },
        {
            "name": "zshcontrib",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshcontrib/1/json"
        },
        {
            "name": "zshexpn",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshexpn/1/json"
        },
        {
            "name": "zshmisc",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshmisc/1/json"
        },
        {
            "name": "ules",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ules/1/json"
        },
        {
            "name": "zshoptions",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshoptions/1/json"
        },
        {
            "name": "zshparam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshparam/1/json"
        },
        {
            "name": "zshroadmap",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshroadmap/1/json"
        },
        {
            "name": "zshtcpsys",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshtcpsys/1/json"
        },
        {
            "name": "zshzftpsys",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshzftpsys/1/json"
        },
        {
            "name": "zshzle",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/zshzle/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Z SHell, a Bash-compatible command-line interpreter.",
        "examples": [
            {
                "description": "Start an interactive shell session",
                "command": "zsh"
            },
            {
                "description": "Execute specific [c]ommands",
                "command": "zsh -c \"{{echo Hello world}}\""
            },
            {
                "description": "Execute a specific script",
                "command": "zsh {{path/to/script.zsh}}"
            },
            {
                "description": "Check a specific script for syntax errors without executing it",
                "command": "zsh {{-n|--no-exec}} {{path/to/script.zsh}}"
            },
            {
                "description": "Execute specific commands from `stdin`",
                "command": "{{echo echo Hello world}} | zsh"
            },
            {
                "description": "Execute a specific script, printing each command in the script before executing it",
                "command": "zsh {{-x|--xtrace}} {{path/to/script.zsh}}"
            },
            {
                "description": "Start an interactive shell session in verbose mode, printing each command before executing it",
                "command": "zsh {{-v|--verbose}}"
            },
            {
                "description": "Start Zsh without loading user level configuration (e.g. `~/.zshrc`)",
                "command": "zsh {{-f|--no-rcs}}"
            }
        ]
    }
}