Internal commands are transferred into memory when the system is started, and are resident memory, so the execution efficiency is high.
The external command is the software function of the system, which is read into memory from the hard disk when the user needs it.
Type can be used to determine whether a command is a built-in command
Type:usage:type [-AFPTP] name [name ...]
[Root@linuxeye ~]# Type type
Type is a shell builtin
[Root@linuxeye ~]# type-p type
[Root@linuxeye ~]# type-t type
Builtin
[Root@linuxeye ~]# Type type
Type is a shell builtin
[Root@linuxeye ~]# type-t type
Builtin
[Root@linuxeye ~]# type pwd
PWD is a shell builtin
[Root@linuxeye ~]# Type Whiptail
Whiptail Is/usr/bin/whiptail
[Root@linuxeye ~]# type-t Whiptail
File
Enable to view both internal commands and to determine whether internal commands
[Root@linuxeye ~]# enable-a #查看内部命令
[Root@linuxeye ~]# Enable Whiptail #非内部命令
-bash:enable:whiptail:not a shell builtin
[Root@linuxeye ~]# enable PWD #是内部命令
Internal command user input when the system calls the speed, not the built-in command, the system will read the environment variable file. bash_profile,/etc/profile to find path paths.
Then in the invocation of the command, some historical commands are used, and there will be in the hash table, and when you enter the command again it will be a process called.
hash--> built-in Command-->path command calls should actually be such a process.
[Root@linuxeye ~]# type pwd
PWD is a shell builtin
[Root@linuxeye ~]# type Cat
Cat Is/usr/bin/cat
[Root@linuxeye ~]# pwd
/root
[Root@linuxeye ~]# ls linuxeye*
Linuxeye.pem Linuxeye.txt
[Root@linuxeye ~]# Cat Linuxeye.txt
Linuxeye
[Root@linuxeye ~]# hash-l #显示hash表
Builtin Hash-p/usr/bin/cat Cat
Builtin hash-p/usr/bin/ls ls
[Root@linuxeye ~]# type Cat
Cat is hashed (/USR/BIN/CAT)
[Root@linuxeye ~]# hash-r #清除hash表
[Root@linuxeye ~]# type Cat
Cat Is/usr/bin/cat
From the above operation can be seen. The hash table does not store system-built commands.