OS Manuals

/usr/bin/ksh

KornShell 93u+m

From ksh 1.0.10-r37 (os), captured 2026-11-05 by running ksh --help (exit 2). permalink

Usage: ksh [ options ] [arg ...]
 Help: ksh [ --help | --man ] 2>&1
OPTIONS
  -c              Read and execute a script from the first arg instead of a file. The second arg,
                  if present, becomes that script's command name ($0). Any third and further args
                  become positional parameters starting at $1.
  -s              Read and execute a script from standard input instead of a file. The command name
                  ($0) cannot be set. Any args become the positional parameters starting at $1.
                  This option is forced on if no arg is given and is ignored if -c is also
                  specified.
  -i              Specifies that the shell is interactive.
  -l              Invoke the shell as a login shell; /etc/profile and $HOME/.profile, if they
                  exist, are read before the first command.
  -r              Invoke the shell in a restricted mode. A restricted shell does not permit any of
                  the following:
                    -     Changing the working directory.
                    -     Setting values or attributes of the variables SHELL, ENV, FPATH, or PATH.
                    -     Executing any command whose name as a / in it.
                    -     Redirecting output of a command with >, >|, <>, or >>.
                    -     Adding or deleting built-in commands or libraries with builtin.
                    -     Executing command -p ... .
  -D              Do not execute the script, but output the set of double quoted strings preceded
                  by a $. These strings are needed for localization of the script to different
                  locales.
  -E              Reads the file ${ENV-$HOME/.kshrc}, if it exists, as a profile. On by default for
                  interactive shells; use +E to disable.
  -a              All variables that are assigned a value while this option is on are automatically
                  exported, unless they have a dot in their name.
  -b              The shell writes a message to standard error as soon it detects that a background
                  job completes rather than waiting until the next prompt.
  -e              A simple command that has an non-zero exit status will cause the shell to exit
                  unless the simple command is:
                    +     contained in an && or || list.
                    +     the command immediately following if, while, or until.
                    +     contained in the pipeline following !.
  -f              Pathname expansion is disabled.
  -h              Obsolete; no effect.
  -k              All arguments of the form name=value are removed and placed in the variable
                  assignment list for the command. Ordinarily, variable assignments must precede
                  command arguments.
  -m              When enabled, the shell runs background jobs in a separate process group and
                  displays a line upon completion. This mode is enabled by default for interactive
                  shells.
  -n              The shell reads commands and checks for syntax errors, but does not execute the
                  command. Usually specified on command invocation.
  -o[option]      A -o with no option will write the list of options and their current settings to
                  standard output. A +o with no option writes a command that the shell can run to
                  restore the current options state. -o option or --option turns an option on,
                  whereas +o option, -o nooption or --nooption turns it off. This can be repeated
                  to enable/disable multiple options. The option name is case-sensitive but
                  insensitive to - and _, and may be abbreviated to a non-arbitrary string. It must
                  resolve to one of the following:
                    allexport
                          Equivalent to -a.
                    backslashctrl
                          The backslash character \ escapes the next control character in the emacs
                          built-in editor and the next erase or kill character in the vi built-in
                          editor. On by default.
                    bgnice
                          Runs background jobs at lower priorities.
                    braceexpand
                          Equivalent to -B.
                    clobber
                          Opposite of -C.
                    emacs Enables/disables emacs editing mode.
                    errexit
                          Equivalent to -e.
                    exec  Opposite of -n.
                    functrace
                          Function scopes and subshells inherit the parent environment's DEBUG trap
                          action. Function scopes inherit the -x option's state.
                    glob  Opposite of -f.
                    globcasedetect
                          Pathname expansion and file name completion automatically become
                          case-insensitive on file systems where the difference between upper- and
                          lowercase is ignored for file names. Each slash-separated path name
                          component pattern p is treated as ~(i:p) if its parent directory exists
                          on a case-insensitive file system.
                    globstar
                          Equivalent to -G.
                    gmacs Enables/disables gmacs editing mode. gmacs editing mode is the same as
                          emacs editing mode except for the handling of ^T.
                    histexpand
                          Equivalent to -H.
                    histreedit
                          If a history expansion (see -H) fails, the command line is reloaded into
                          the next prompt's edit buffer, allowing corrections.
                    histverify
                          The results of a history expansion (see -H) are not immediately executed.
                          Instead, the expanded line is loaded into the next prompt's edit buffer,
                          allowing further changes.
                    ignoreeof
                          Prevents an interactive shell from exiting on reading an end-of-file.
                    keyword
                          Equivalent to -k.
                    letoctal
                          The let builtin recognizes octal constants with leading 0.
                    markdirs
                          A trailing / is appended to directories resulting from pathname
                          expansion.
                    monitor
                          Equivalent to -m.
                    multiline
                          Use multiple lines when editing lines that are longer than the window
                          width. Has no effect on systems with neither terminfo nor termcap support
                          for the running terminal.
                    log   Obsolete; no effect.
                    notify
                          Equivalent to -b.
                    pipefail
                          A pipeline will not complete until all components of the pipeline have
                          completed, and the exit status of the pipeline will be the value of the
                          last command to exit with non-zero exit status, or will be zero if all
                          commands return zero exit status.
                    posix Enable full POSIX standard compliance mode.
                    privileged
                          Equivalent to -p.
                    showme
                          Simple commands preceded by a ; will be traced as if -x were enabled but
                          not executed.
                    trackall
                          Equivalent to -h.
                    unset Opposite of -u.
                    verbose
                          Equivalent to -v.
                    vi    Enables/disables vi editing mode.
                    viraw Obsolete; no effect.
                    xtrace
                          Equivalent to -x.
                  The option value may be omitted.
  --posix         Enable the posix option. When given at invocation time, disables importing
                  variable type attributes from the environment.
  -p              Privileged mode. Disabling -p sets the effective user ID to the real user ID, and
                  the effective group ID to the real group ID. Enabling -p restores the effective
                  user and group IDs to their values when the shell was invoked. The -p option is
                  on whenever the real and effective user ID is not equal or the real and effective
                  group ID is not equal. User profiles are not processed when -p is enabled.
  -r              restricted. Enables restricted shell. This option cannot be unset once enabled.
  -t              Obsolete. The shell reads one command and then exits.
  -u              If enabled, the shell displays an error message when it tries to expand a
                  variable that is unset.
  -v              Verbose. The shell displays its input onto standard error as it reads it.
  -x              Execution trace. The shell will display each command after all expansion and
                  before execution preceded by the expanded value of the PS4 parameter.
  -B              Enable {...} group expansion. On by default.
  -C              Prevents existing regular files from being overwritten using the > redirection
                  operator. The >| redirection overrides this noclobber option.
  -G              Causes ** by itself to also match all subdirectories during pathname expansion.
  -H              Enable !-style history expansion similar to csh.
Options (45)
OptionDescriptionSource
-c fileRead and execute a script from the first arg instead of a file.help + man
-s fileRead and execute a script from standard input instead of a file.help + man
-iDeclares vname to be represented internally as integer.help + man
-lUsed with -i, -E or -F, to indicate long integer, or long float.help + man
-r fileTrue if file exists and is readable by current process.help + man
-DA list of all double quoted strings that are preceded by a $ will be printed on standard output and the shell will exit.help + man
-EReads the file ${ENV-$HOME/.kshrc}, if it exists, as a profile.help + man
-a fileAll variables that are assigned a value while this option is on are automatically exported, unless they have a dot in their name.help + man
-b fileThe shell writes a message to standard error as soon it detects that a background job completes rather than waiting until the next prompt.help + man
-e fileA simple command that has an non-zero exit status will cause the shell to exit unless the simple command is: + contained in an && or || list.help + man
-f fileTrue if file exists and is an ordinary file.help + man
-h fileTrue if file exists and is a symbolic link.help + man
-k fileAll arguments of the form name=value are removed and placed in the variable assignment list for the command.help + man
-mWhen enabled, the shell runs background jobs in a separate process group and displays a line upon completion.help + man
-n stringThe shell reads commands and checks for syntax errors, but does not execute the command.help + man
-o optionA -o with no option will write the list of options and their current settings to standard output.help + man
--posixEnable the posix option.help
-p fileTrue if file exists and is a fifo special file or a pipe.help + man
-t fildesTrue if file descriptor number fildes is open and associated with a terminal device.help + man
-u fileIf enabled, the shell displays an error message when it tries to expand a variable that is unset.help + man
-v nameTrue if variable name is a valid variable name and is set.help + man
-x fileTrue if file exists and is executable by current process.help + man
-BEnable {...} group expansion.help + man
-CPrevents existing regular files from being overwritten using the > redirection operator.help + man
-G fileTrue if file exists and its group matches the effective group ID of this process.help + man
-HEnable !-style history expansion similar to csh(1).help + man
-d fileTrue if file exists and is a directory. (in the manual page but not in --help)man
-g fileTrue if file exists and it has its setgid bit set. (in the manual page but not in --help)man
-w fileTrue if file exists and is writable by current process. (in the manual page but not in --help)man
-z stringTrue if length of string is zero. (in the manual page but not in --help)man
-L fileTrue if file exists and is a symbolic link. (in the manual page but not in --help)man
-N fileTrue if file exists and the modification time is greater than the last access time. (in the manual page but not in --help)man
-O fileTrue if file exists and is owned by the effective user ID of this process. (in the manual page but not in --help)man
-R nameTrue if variable name is a name reference. (in the manual page but not in --help)man
-S fileTrue if file exists and is a socket. (in the manual page but not in --help)man
-yEquivalent to 0-y. (in the manual page but not in --help)man
-ACauses the variable vname to be unset and each field that is read to be stored in successive elements of the indexed array vname. (in the manual page but not in --help)man
-FDeclares vname to be a double precision floating point number. (in the manual page but not in --help)man
-MUse the character mapping mapping defined by wctrans(3). (in the manual page but not in --help)man
-TIf followed by tname, it creates a type named by tname using the compound assignment assign_list to tname. (in the manual page but not in --help)man
-XDeclares vname to be a double precision floating point number and expands using the %a format of ISO-C99. (in the manual page but not in --help)man
-ZRight justify and fill with leading zeros if the first non-blank character is a digit and the -L option has not been set. (in the manual page but not in --help)man
-PThe max number of pseudo-terminals created by the current user. (in the manual page but not in --help)man
-qThe message queue size in K-bytes. (in the manual page but not in --help)man
-VThe number of open vnode monitors. (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.