shell builtin
{{Short description|Computer function}}
In computing, a shell builtin is a command or a function, exposed by a shell, that is implemented in the shell itself, instead of an external program which the shell would load and execute.[http://pubs.opengroup.org/onlinepubs/9699919799//utilities/V3_chap02.html#tag_18_09 POSIX standard: Shell Commands]{{cite book |last1=Tansley |first1=David |title=Linux and Unix shell programming |date=2000 |publisher=Addison-Wesley |location=Harlow |isbn=9780201674729 |chapter=24. Shell built-in commands}}{{cite book |last1=Sobell |first1=Mark G. |title=A Practical Guide to Red Hat Linux 8 |date=2003 |pages=161–162 |chapter-url=https://books.google.com/books?id=7ExfDfcLZXsC&dq=shell+built-in+commands&pg=PA162 |chapter=Built-ins}}{{cite book |author1=Albing, Carl |author2=Vossen, JP |author3=Newham, Cameron |title=Bash Cookbook |publisher=O'Reilly Media |isbn=9780596554705 |pages=13–15 |chapter-url=https://books.google.com/books?id=Qu6H8fnAvGoC&dq=shell+built-in+commands&pg=PA14 |chapter=1.7. Using or Replacing Built-ins and External Commands}}
A shell builtin starts faster than an external program because there is no program loading overhead. However, its implementation code is in the shell program, and thus modifying it requires modifying the shell. Therefore, a shell builtin is usually only used for simple, almost trivial, commands, such as text output.
Some commands must be implemented as builtins due to the nature of the operating system.
Notably, the cd
command, which changes the working directory of the shell is often a builtin since a program runs in a separate process and working directory is specific to each process. Running cd
as an external program would not affect the working directory of the shell that loaded it.{{cite book |last1=Kuhn |first1=Darl |last2=Kim |first2=Charles |last3=Lopuz |first3=Bernard |title=Linux and Solaris Recipes for Oracle DBAs |date=2015 |publisher=Apress |location=Berkeley, CA |isbn=9781484212547 |pages=47 |edition=2nd |url=https://books.google.com/books?id=p-wLCwAAQBAJ&dq=shell+built-in+commands&pg=PA46}}
See also
- {{Annotated link|BusyBox}}
- {{Annotated link|Internal DOS command}}
References
{{Reflist}}
External links
- [http://pubs.opengroup.org/onlinepubs/9699919799//utilities/V3_chap02.html#tag_18_14 List of special shell builtin commands]
- [http://www.computerhope.com/jargon/i/intecomm.htm List of MS-DOS internal commands]
{{Unix commands}}
{{Windows commands}}
{{DEFAULTSORT:Shell Builtin}}
{{Operating-system-stub}}