Regular built-in command descriptions for the Korn shell or POSIX shell

The built-in commands for the Korn or POSIX shells are described here.

The Korn shell provides the following regular built-in commands:

alias           fg             print           ulimit
bg              getopts        pwd             umask
cd              jobs           read            unalias
command         kill           setgroups       wait
echo            let            setsenv            test            whence
fc

Item Description
alias [-t ] [-x ] [AliasName[= String]] ... Creates or redefines alias definitions or writes existing alias definitions to standard output.

For more information, see the alias command.

bg [JobID...] Puts each specified job into the background. The current job is put in the background if a JobID parameter is not specified. See Job control in the Korn shell or POSIX shell for more information about job control.

For more information about running jobs in the background, see the bg command.

cd [Argument]  
cd Old New This command can be in either of two forms. In the first form, it changes the current directory to the one specified by the Argument parameter. If the value of the Argument parameter is a hyphen (-), the directory is changed to the previous directory. The HOME shell variable is the default value of the Argument parameter. The PWD variable is set to the current directory.

The CDPATH shell variable defines the search path for the directory containing the value of the Argument parameter. Alternative directory names are separated by a colon (:). The default path is null, specifying the current directory. The current directory is specified by a null path name, which appears immediately after the equal sign or between the colon delimiters anywhere in the path list. If the specified argument begins with a slash (/), the search path is not used. Otherwise, each directory in the path is searched for the argument.

The second form of the cd command substitutes the string specified by the New variable for the string specified by the Old variable in the current directory name, PWD, and tries to change to this new directory.

command [-p ] CommandName [Argument ...]  
command [-v | -V ] CommandName Causes the shell to treat the specified command and arguments as a simple command, suppressing shell-function lookup.

For more information, see the command command.

echo [String ...] Writes character strings to standard output. See the echo command for usage and description. The -n flag is not supported.
fc [-r ] [-e Editor] [First [Last]]  
fc -l [-n ] [-r ] [First [Last]]  
fc -s [Old= New] [First] Displays the contents of your command history file or invokes an editor to modify and re-execute commands previously entered in the shell.

For more information, see the fc command.

fg [JobID] Brings each job specified into the foreground. If you do not specify any jobs, the command brings the current job into the foreground.

For more information about running jobs in the foreground, see the fg command.

getopts OptionString Name [Argument ...] Checks the Argument parameter for legal options.

For more information, see the getopts command.

jobs [-l | -n | -p ] [JobID ...] Displays the status of jobs started in the current shell environment. If no specific job is specified with the JobID parameter, status information for all active jobs is displayed. If a job termination is reported, the shell removes that job's process ID from the list of those known by the current shell environment.

For more information, see the jobs command.

kill [ -s { SignalName | SignalNumber } ] ProcessID... Sends a signal (by default, the SIGTERM signal) to a running process. This default action normally stops processes. If you want to stop a process, specify the process ID (PID) in the ProcessID variable. The shell reports the PID of each process that is running in the background (unless you start more than one process in a pipeline, in which case the shell reports the number of the last process). You can also use the ps command to find the process ID number of commands.
kill [ -SignalName | -SignalNumber ] ProcessID...
kill -l [ ExitStatus ] Lists signal names.

For more information, see the kill command.

let Expression ... Evaluates specified arithmetic expressions. The exit status is 0 if the value of the last expression is nonzero, and 1 otherwise. See Arithmetic evaluation in the Korn shell or POSIX shell for more information.
print [-Rnprsu [n]] [Argument ...] Prints shell output. If you do not specify any flags, or if you specify the hyphen (-) or double hyphen () flags, the arguments are printed to standard output as described by the echo command. The flags do the following:
-R
Prints in raw mode (the escape conventions of the echo command are ignored). The -R flag prints all subsequent arguments and flags other than -n.
-n
Prevents a newline character from being added to the output.
-p
Writes the arguments to the pipe of the process run with |& instead of to standard output.
-r
Prints in raw mode. The escape conventions of the echo command are ignored.
-s
Writes the arguments to the history file instead of to standard output.
-u
Specifies a one-digit file descriptor unit number, n, on which the output is placed. The default is 1.
pwd Equivalent to print -r - $PWD.
Note: The internal Korn shell pwd command does not support symbolic links.
read [-prsu [n ]] [Name?Prompt] [Name...] Takes shell input. One line is read and broken up into fields, using the characters in the IFS variable as separators.

For more information, see the read command.

setgroups Executes the /usr/bin/setgroups command, which runs as a separate shell. See the setgroups command for information on this command. There is one difference, however. The setgroups built-in command invokes a subshell, but the setgroups command replaces the currently executing shell. Because the built-in command is supported only for compatibility, it is recommended that scripts use the absolute path name /usr/bin/setgroups rather than the shell built-in command.
setsenv Executes the /usr/bin/setsenv command, which replaces the currently executing shell. See the setsenv command for information on this command.
test Same as [expression]. See Conditional expressions for the Korn shell or POSIX shell for usage and description.
ulimit [-HSacdfmst ] [Limit] Sets or displays user-process resource limits as defined in the /etc/security/limits file. This file contains the following default limits:
fsize = 2097151
core = 2048
cpu = 3600
data = 131072
rss = 65536
stack = 8192
threads = -1

These values are used as default settings when a user is added to the system. The values are set with the mkuser command when the user is added to the system or changed with the chuser command.

Limits are categorized as either soft or hard. Users might change their soft limits, up to the maximum set by the hard limits, with the ulimit command. You must have root user authority to change resource hard limits.

Many systems do not contain one or more of these limits. The limit for a specified resource is set when the Limit parameter is specified. The value of the Limit parameter can be a number in the unit specified with each resource or the value unlimited. You can specify the following ulimit command flags:

-H
Specifies that the hard limit for the given resource is set. If you have root user authority, you can increase the hard limit. Any user can decrease it.
-S
Specifies that the soft limit for the given resource is set. A soft limit can be increased up to the value of the hard limit. If neither the -H or -S options are specified, the limit applies to both.
-a
Lists all of the current resource limits.
-c
Specifies the number of 512-byte blocks on the size of core dumps.
-d
Specifies the size, in KB, of the data area.
-f
Specifies the number of 512-byte blocks for files written by child processes (files of any size can be read).
-m
Specifies the number of KB for the size of physical memory.
-n
Specifies the limit on the number of file descriptors a process might have open.
-r
Specifies the limit on the number of threads per process.
-s
Specifies the number of KB for the size of the stack area.
-t
Specifies the number of seconds to be used by each process.
 

The current resource limit is printed when you omit the Limit variable. The soft limit is printed unless you specify the -H flag. When you specify more than one resource, the limit name and unit is printed before the value. If no option is given, the -f flag is assumed. When you change the value, set both hard and soft limits to Limit unless you specify -H or -S.

For more information about user and system resource limits, see the getrlimit, setrlimit, or vlimit subroutine.

umask [-S ] [Mask] Determines file permissions. This value, along with the permissions of the creating process, determines a file's permissions when the file is created. The default is 022. If the Mask parameter is not specified, the umask command displays to standard output the file-mode creation mask of the current shell environment.

For more information about file permissions, see the umask command.

unalias-a | AliasName... } Removes the definition for each alias name specified, or removes all alias definitions if the -a flag is used. Alias definitions are removed from the current shell environment.

For more information, see the unalias command.

wait [ProcessID...] Waits for the specified job and terminates. If you do not specify a job, the command waits for all currently active child processes. The exit status from this command is that of the process for which it waits.

For more information, see the wait command.

whence [-pv ] Name ... Indicates, for each name specified, how it would be interpreted if used as a command name. When used without either flag, whence will display the absolute path name, if any, that corresponds to each name.
-p
Performs a path search for the specified name or names even if these are aliases, functions, or reserved words.
-v
Produces a more verbose report that specifies the type of each name.