Daily summary -DAY2
Internal commands and external commands
Linux commands into internal commands and external commands, wherein the internal command loading into memory at system startup, the interpreter can be used directly for the shell, the internal command functions are usually simple commands. The external commands are normally stored in the disk system, will go only when using an external disk in order to load external commands.
Typically, to determine a type command is a command or commands are internal external command, the command basic format is as follows:
type [command]
When prompted "XXX is a shell builtin", the description for this command is a built-in command.
[root@centos7 ~]#type echo
echo is a shell builtin
When prompted "XXX is / usr / bin / who", the description for this command is a built-in command, where / usr / bin / who is the folder where the command position.
[root@centos7 ~]#type who
who is /usr/bin/who
External command execution process
After the external command, the command will be the location where the file is stored to the cache, when re-use the cached off external commands, you can find the location of the command to run directly through memory, to repeat the efficient use of the same external commands. You can use:
[hash] command to view the current cache of external commands.
[root@centos7 ~]#hash
hits command
2 /usr/bin/stat
2 /usr/bin/man
3 /usr/bin/ls
1 /usr/bin/clear
- Note: If the position of the external command file is moved, since the cache file location command does not exist, the operation portion when the command being given in addition
By hash -r: clear all cache hash
or
hash -r [command]: Clear the cache hash specified command
All commands execution order
Priority descending order from left to right:
Alias ---> internal command ---> external command ---> external command cache