In computing, a shell builtin is a
command
Command may refer to:
Computing
* Command (computing), a statement in a computer language
* COMMAND.COM, the default operating system shell and command-line interpreter for DOS
* Command key, a modifier key on Apple Macintosh computer keyboards
...
or a
function, called from a
shell, that is executed directly in the shell itself, instead of an external executable
program which the shell would load and execute.
POSIX standard: Shell Commands
/ref>
Shell builtins work significantly faster than external programs, because there is no program loading overhead. However, their code is inherently present in the shell, and thus modifying or updating them requires modifications to the shell. Therefore, shell builtins are usually used for simple, almost trivial, functions, such as text output.
Because of the nature of some operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s, some functions of the systems must necessarily be implemented as shell builtins. The most notable example is the cd
command, which changes the working directory
In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with each process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd function, or just ...
of the shell. Since each executable program runs in a separate process
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
*Business process, activities that produce a specific se ...
, and working directories are specific to each process, loading cd
as an external program would not affect the working directory of the shell that loaded it.
Examples
A widely used shell-builtin is the logout
function, which terminates the session. This function has different names depending on the shell.
See also
* Internal DOS command
References
External links
List of special shell builtin commands
Command shells
{{Operating-system-stub