The shell has a number of commands that are built-in to its source code. Because the commands are built-in, the shell doesn't have to locate them on disk, making execution much faster. The help feature provided with bash give you online help for any built-in command. The built-in commands are listed in Table 9.12 on page 481.
Table 9.12. Built-In Commands
What It Does
Do-nothing command; returns exit status zero.
The dot command reads and executes command from file.
See the looping commands on page 443.
Do-nothing command; returns 0 exit status.
Executes program in context of current process; same as source.
Lists and creates "nicknames" for existing commands.
Puts a job in the background.
Displays current key and function bindings, or binds keys to a readline function or macro.
Breaks out of the innermost loop.
builtin [ sh-builtin [args]]
Runs a shell built-in, passing it args, and returning 0 exit status. Useful if a function and built-in have the same name.
Changes the directory to home if no arg or to arg.
command command* [arg]
Runs a command even if a function has the same name; i.e., bypasses function lookup.
See the looping commands on page 444.
Displays all variables or declares variables with optional attributes.
Displays a list of currently remembered directories resulting from pushd.
Removes an active job from the job table.
Displays args terminated with a newline.
Enables and disables shell built-in commands.
Reads args as input to the shell and executes the resulting command(s).
Runs command in place of this shell.
exit [ n ]
Exits the shell with status n.
export [ var ]
Makes var known to subshells.
History's fix command for editing history commands.
Puts background job into foreground.
Parses and processes command line options.
Controls the internal hash table for quicker searches for commands.
help [command ]*
Displays helpful info about built-in commands and, if command is specified, detailed help about that built-in command.
Displays the history list with line numbers.
Lists jobs put in the background.
kill [-signal process ]
Sends the signal to the pid number or job number of the process. Type kill -l for a list of signals.
Used in shell scripts to parse command line and check for legal options.
Used for evaluating arithmetic expressions and assigning results of arithmetic calculations to variables.
Used in functions to restrict the scope of variables to the function.
Exits the login shell.
Removes entries from the directory stack.
Adds entries to the directory stack.
Prints present working directory.
read [ var ]
Reads line from standard input into variable var.
readonly [ var ]
Makes variable var read-only. Cannot be reset.
return [ n ]
Returns from a function where n is the exit value given to the return.
Sets options and positional parameters. See Table 9.2 on page 396.
Shifts positional parameters to the left n times.
Halts execution of the process number pid.
Stops execution of the current shell (but not if a login shell).
Checks file types and evaluates conditional expressions.
Prints accumulated user and system times for processes run from this shell.
trap [ arg ] [ n ]
When shell receives signal n ( 0, 1, 2, or 15), executes arg.
type [ command ]
Prints the type of command; e.g., pwd is a built-in shell command.
Same as declare. Sets variables and gives them attributes.
Diplays and sets process resource limits.
umask [ octal digits ]
Sets user file creation mode mask for owner, group, and others.
unset [ name ]
Unset value of variable or function.
wait [ pid#n ]
Waits for background process with pid number n and reports termination status.