Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the built-in commands in Bash Shell

Shulou Source: shulou.com Published: 2022-06-01 13:02:03 10月04日 Update

This article mainly explains "what built-in commands Bash Shell has". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian to study and learn "what built-in commands Bash Shell has" together.

Types of built-in commands

Bourne Shell Built-in Commands: Built-in commands inherit from Bourne Shell.

Bash built-in commands: Bash-specific built-in command list.

Modify Shell Behavior: Built-in commands to modify shell attributes and optional behavior.

Special built-in commands: Built-in commands specifically classified by POSIX.

How to view all bash built-in commands

There are the following orders:

$ help$ help | less$ help | grep read

Sample output:

GNU bash, version 4.1.5(1)-release (x86_64-pc-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 ; }

Another option is to use the following command:

compgen -bcompgen -b |more View Bash's built-in command information

Run the following for details:

help commandhelp read

To get only a list of all built-in commands with short descriptions, perform the following:

$ help -d Find syntax and other options for built-in commands

Use the following syntax to find more relevant built-in commands:

help name help cd help fg help for help read help :

Sample output:

:: : Null command. No effect; the command does nothing. Exit Status: Always succeeds Find out if a command is internal (built-in) or external

Use the type command or command:

type -a command-name-here type -a cd type -a uname type -a : type -a ls

Or:

type -a cd uname : ls uname

Sample output:

cd is a shell builtinuname is /bin/uname: is a shell builtinls is aliased to `ls --color=auto'ls is /bin/lsl is a functionl (){ ls --color=auto}

Or:

command -V ls command -V cd command -V foo

Thank you for reading, the above is the content of "What built-in commands do Bash Shell have", after learning this article, I believe that everyone has a deeper understanding of what built-in commands Bash Shell has, and the specific use needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Commands learning output information content more behavior grammar brevity that is attributes ideas situations articles knowledge knowledge points articles types follow or Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Microsoft Xiaomi Shulou Tech Info NVidia