Shell builtin

Shell builtin

In computing, a shell builtin is a command 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.

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 operating systems, some functions of the systems have to be implemented as shell builtins. The most notable example is the cd command, which changes the working directory of the shell. Because each executable program runs in a separate process, 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.

Some examples from bash include $ cd .. Loops (if, while, for and such) $ echo

The help bash-builtin command will list all builtins.

Table of Built In Commands

Command Bourne Almquist Sash

: Yes Yes . Yes Yes ! No Yes ( Yes ) Yes { Yes Yes } Yes Yes alias No Yes bg No Yes break Yes Yes case Yes Yes cd Yes Yes command No Yes continue Yes Yes do Yes Yes done Yes Yes echo Yes No [1] elif Yes Yes else Yes Yes esac Yes Yes eval Yes Yes exec Yes Yes exit Yes Yes export Yes Yes fc No Yes fg No Yes fi Yes Yes for Yes Yes getopts No Yes hash Yes Yes if Yes Yes jobs No Yeskill No Yes pwd Yes Yes read Yes Yes readonly Yes Yes return Yes No printf No Yes set Yes Yes shift Yes Yes test Yes Yes then Yes Yes times Yes Yes trap Yes Yes type Yes No ulimit Yes Yes umask Yes Yes unalias No Yes unset Yes Yes until Yes Yes wait Yes Yes while Yes Yes


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Shell (computing) — A shell is a piece of software that provides an interface for users of an operating system which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is… …   Wikipedia

  • Friendly interactive shell — infobox software name = fish caption = The friendly interactive shell author = Axel Liljencrantz developer = Axel Liljencrantz released = latest release version = 1.23.0 latest release date = 13 January 2008 operating system = Unix like genre =… …   Wikipedia

  • Bourne-again shell — Bash Beispiel einer bash Sitzung Basisdaten Entwickler Chet Ramey Aktuelle Version …   Deutsch Wikipedia

  • Job control (Unix) — On operating systems that support executing multiple processes in parallel or in series (batch processing), job control refers to the orchestration of multiple batch jobs.Unix shellWhen using Unix or related operating systems via a terminal, a… …   Wikipedia

  • nohup — is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.… …   Wikipedia

  • Type (Unix) — type is a Unix command that displays how a name would be interpreted if used as a command.yntax type nameDescriptionThe type command display how a name would be interpreted as a command. Where applicable type will display the name s path.… …   Wikipedia

  • Nohup — is a Unix command that is used to run another command while suppressing the action of the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. It is most often used to run commands in the …   Wikipedia

  • Pwd — The pwd command (print working directory) is used to print the name of current working directory from a computer s command line interface. If the shell prompt does not already show this, the user can use this command to find their place in the… …   Wikipedia

  • Wait (command) — In computing, wait is a command which pauses until execution of a background process has ended.Usage wait [n] where n is the pid or job ID of a currently executing background process (job). If n is not given, the command waits until all jobs… …   Wikipedia

  • Time (Unix) — time is a command in the Unix operating systems. It is used to determine the duration of execution of a particular command.UsageTo use the command, simply precede any command by the word time, such as:time lsWhen the command completes, time will… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”