<Built-in commands and external commands in linux>
Built-in and external commands in Linux
1. linux commands can be divided into internal commands and external commands:
Internal commands are transferred to the memory at system startup, Which is resident memory, so the execution efficiency is high.
External commands are the software functions of the system. Users can read the memory from the hard disk only when needed.
Enable allows you to view internal commands and determine whether an internal command is used.
[Root @ localhost ~] # Enable ls // determine if ls is a built-in command
-Bash: enable: ls: not a shell builtin // It is not an internal command
[Root @ localhost ~] # Enable pwd // pwd is an internal command
[Root @ localhost ~] # Enable-n // disable the use of pwd Internal Command-n
[Root @ localhost ~] # Enable-a | grep pwd // check whether it is disabled
Enable-n pwd
[Root @ localhost ~] # Enable pwd // enable the built-in pwd command
[Root @ localhost ~] # Enable-a | grep pwd
Enable pwd
When you enter Internal commands, the system calls the system at a fast speed. Instead of a built-in command, the system will read the environment variable file. bash_profile and/etc/profile to find the PATH.
Next, let's mention the call of the command. Some Historical commands will exist in the hash table after they are used. When you enter the command again, it will be called like this.
The calling of hash --> built-in command --> PATH command is actually such a process.
[Root @ localhost ~] # Pwd
/Root
[Root @ localhost ~] # Ls
Anaconda-ks.cfg install. log install. log. syslog
[Root @ localhost ~] # Hash-l // display the hash table
Builtin hash-p/bin/cat
Builtin hash-p/bin/ls
We can see from the hash table. The hash table does not store built-in commands.