What is the built-in command of the bash shell

Source: Internet
Author: User
Tags builtin echo command

1. What is the build in command:

The shell built-in command refers to commands in the bash (or other versions) toolset. There is usually a system command with the same name, such as the echo command in bash and the/bin/echo are two different commands, although they are roughly similar in their behavior. When you type a command in bash, the system will first see if he is a built-in command, and if not, see if it is a system command or a third-party tool. So typing the echo command in bash actually executes the Bash command in the Bash toolset, which is the built-in command instead of/bin/echo the system command.

2. Built-in commands and system commands

The built-in command has higher execution efficiency than the system-theory command. External commands often need to fork out (produce) a sub-process, while the built-in commands are generally not used. Below (and perhaps later) this article will brief bash's built-in commands.

3. See if a command is a system command or built-in command: type

[Email protected]:~/documents
$ type-a pwd
PWD is a shell builtin
PWD is/bin/pwd

[Email protected]:~/documents
$ type-a Echo
Echo is a shell builtin
Echo Is/bin/echo

As you can see, some commands, Echo and PWD are both built-in commands and system commands.

4. Types of COMMON commands


[[email protected] ~]# type-a CD

CD is a shell builtin
[Email protected] ~]# type-a pwd
PWD is a shell builtin
PWD is/bin/pwd
[Email protected] ~]# type-a time
Time is a shell keyword
Time Is/usr/bin/time
[Email protected] ~]# type-a Date
Date Is/bin/date
[Email protected] ~]# type-a which
Which is aliased to ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '
Which Is/usr/bin/which
[Email protected] ~]# type-a Whereis
Whereis Is/usr/bin/whereis
[Email protected] ~]# type-a Whatis
Whatis Is/usr/bin/whatis
[[email protected] ~]# type-a function
function is a shell keyword
[[email protected] ~]# type-a ls
LS is aliased to ' LS--color=tty '
LS Is/bin/ls
[Email protected] ~]# type-a ll
ll is aliased to ' ls-l--color=tty '
[Email protected] ~]# type-a Echo
Echo is a shell builtin
Echo Is/bin/echo
[Email protected] ~]# type-a Bulitin
-bash:type:bulitin:not found
[Email protected] ~]# type-a builtin
Builtin is a shell builtin
[Email protected] ~]# type-a keyword
-bash:type:keyword:not found
[[email protected] ~]# type-a command
command is a shell builtin
[Email protected] ~]# type-a alias
Alias is a shell builtin
[[email protected] ~]# type-a grep
grep is/bin/grep
[Email protected] ~]#

What is the built-in command of the bash shell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.