OSETC TECH

Linux List All Built-in Commands

This post will guide you how to list all available shell built-in commands in Linux. How do I list all built-in command with a Linux command in Linux operating system.

A built-in command is a Linux/Unix command which is built into a shell interpreter. And it is a only a command and not a function, and it will be called by shell program, such as: bash, sh, etc.

Linux List All Built-in Commands


If you want to list all available built-in command in Linux, you can execute the help command under command line interface in Linux. Type one of the following command:

#help

Or

#help | less

Outputs:

[root@devops ~]# help

GNU bash, version 4.1.2(2)-release (x86_64-redhat-linux-gnu)

These shell commands are defined internally.  Type `help' to see this list.

Type `help name' to find out more about the function `name'.

Use `info bash' to find out more about the shell in general.

Use `man -k' or `info' to find out more about commands not in this list.




A star (*) next to a name means that the command is disabled.




job_spec [&]                            history [-c] [-d offset] [n] or hist>

(( expression ))                        if COMMANDS; then COMMANDS; [ elif C>

. filename [arguments]                  jobs [-lnprs] [jobspec ...] or jobs >

:                                       kill [-s sigspec | -n signum | -sigs>

[ arg... ]                              let arg [arg ...]

[[ expression ]]                        local [option] name[=value] ...

alias [-p] [name[=value] ... ]          logout [n]

bg [job_spec ...]                       mapfile [-n count] [-O origin] [-s c>

bind [-lpvsPVS] [-m keymap] [-f filen>  popd [-n] [+N | -N]

break [n]                               printf [-v var] format [arguments]

builtin [shell-builtin [arg ...]]       pushd [-n] [+N | -N | dir]

caller [expr]                           pwd [-LP]

case WORD in [PATTERN [| PATTERN]...)>  read [-ers] [-a array] [-d delim] [->

cd [-L|-P] [dir]                        readarray [-n count] [-O origin] [-s>

command [-pVv] command [arg ...]        readonly [-af] [name[=value] ...] or>

compgen [-abcdefgjksuv] [-o option]  >  return [n]

complete [-abcdefgjksuv] [-pr] [-DE] >  select NAME [in WORDS ... ;] do COMM>

compopt [-o|+o option] [-DE] [name ..>  set [--abefhkmnptuvxBCHP] [-o option>

continue [n]                            shift [n]

coproc [NAME] command [redirections]    shopt [-pqsu] [-o] [optname ...]

declare [-aAfFilrtux] [-p] [name[=val>  source filename [arguments]

dirs [-clpv] [+N] [-N]                  suspend [-f]

disown [-h] [-ar] [jobspec ...]         test [expr]

echo [-neE] [arg ...]                   time [-p] pipeline

enable [-a] [-dnps] [-f filename] [na>  times

eval [arg ...]                          trap [-lp] [[arg] signal_spec ...]

exec [-cl] [-a name] [command [argume>  true

exit [n]                                type [-afptP] name [name ...]

export [-fn] [name[=value] ...] or ex>  typeset [-aAfFilrtux] [-p] name[=val>

false                                   ulimit [-SHacdefilmnpqrstuvx] [limit>

fc [-e ename] [-lnr] [first] [last] o>  umask [-p] [-S] [mode]

fg [job_spec]                           unalias [-a] name [name ...]

for NAME [in WORDS ... ] ; do COMMAND>  unset [-f] [-v] [name ...]

for (( exp1; exp2; exp3 )); do COMMAN>  until COMMANDS; do COMMANDS; done

function name { COMMANDS ; } or name >  variables - Names and meanings of so>

getopts optstring name [arg]            wait [id]

hash [-lr] [-p pathname] [-dt] [name >  while COMMANDS; do COMMANDS; done

help [-dms] [pattern ...]               { COMMANDS ; }

Get More Information for Built-in Commands


If you want to get more information for a given build-in command, you can use help command and passing that built-in command.

For example, checking the detailed information about eval command. Type the following command:

#help eval

Outputs:

[root@devops ~]# help eval
eval: eval [arg ...]
Execute arguments as a shell command.

Combine ARGs into a single string, use the result as input to the shell, and execute the resulting commands.

Exit Status:

Returns exit status of command or success if command is null.

Check If a Command is Built-in command


If you want to check if a given command is a built-in command or not. You can use another Linux command type. Type the following command:

#type –a  eval

Outputs:

[root@devops ~]# type -a eval

eval is a shell builtin