Shell
builtin
Run a shell builtin explicitly.
shellbuiltinbashcommand
Additional Notes
builtin is a Bash command that runs a shell builtin directly, bypassing shell functions with the same name. It is useful inside wrapper functions.
For example, if you define a function named cd, you can still call the real shell builtin with builtin cd.
Syntax
builtin shell-builtin [arguments...]
Parameters
shell-builtin: Name of a Bash builtin command.arguments: Arguments passed to that builtin.
Examples
builtin cd /tmp
Run the real cd builtin.
cd() {
builtin cd "$@" || return
pwd
}
Wrap cd while still calling the original builtin.
type cd
Check whether a command is a builtin, function, alias, or executable.
Practical Notes
builtinis Bash-specific behavior, not a normal external program.- Use
commandto bypass shell functions and aliases when running external commands. - Use
enableto enable or disable shell builtins in Bash.