Get a list of all shell built-ins

Last update: 05 July, 2023

The help built-in command explains what a particular shell built-in does. The help menu of help says:

$ help --help
# or $ help help :)

help: help [-dms] [pattern ...]
    Display information about builtin commands.

    Displays brief summaries of builtin commands.  If PATTERN is
    specified, gives detailed help on all commands matching PATTERN,
    otherwise the list of help topics is printed.

    Options:
      -d        output short description for each topic
...

So, if you use the -d option to get a short description, and pass the '*' as a pattern to get information for all topics, you get a list with all the shell built-in commands and what they do:

$ help -d '*'

Shell commands matching keyword `*'

% - Resume job in foreground.
(( ... )) - Evaluate arithmetic expression.
. - Execute commands from a file in the current shell.
: - Null command.
[ - Evaluate conditional expression.
[[ ... ]] - Execute conditional command.
alias - Define or display aliases.
bg - Move jobs to the background.
bind - Set Readline key bindings and variables.
break - Exit for, while, or until loops.
builtin - Execute shell builtins.
caller - Return the context of the current subroutine call.
case - Execute commands based on pattern matching.
cd - Change the shell working directory.
...
until - Execute commands as long as a test does not succeed.
variables - Common shell variable names and usage.
wait - Wait for job completion and return exit status.
while - Execute commands as long as a test succeeds.
{ ... } - Group commands as a unit.

How do you know if a command is a shell built-in?

You can use the type shell built-in:

$ type cd

cd is a shell builtin

$ type cp

cp is /usr/bin/cp
# cp is not a shell built-in

What are shell built-in commands anyway?

TL;DR:

Builtin commands are contained within the shell itself.

Other things to read

Popular

Previous/Next