The role of the linux hash command

hash command

  Note: There will be a hash table under the linux system. When you first boot, the hash table is empty. Whenever you execute a command, the hash table will record the path of the command, which is equivalent to a cache. The first time you execute a command, the shell interpreter will look for the path of the command from the PATH path by default. When you use the command for the second time, the shell interpreter will first check the hash table. :

  hits indicates the number of times the command was entered recently

 

  parameter:

  

hash -l #Parameter -l You can see both the path of the hash table command and its name. The results are as follows
#builtin hash -p /bin/rm rm
#builtin hash -p /usr/bin/wget wget
#builtin hash -p /usr/bin/awk awk
#builtin hash -p /usr/bin/man man

hash -p #
hash -p /usr/bin/grep grep #Add grep to the hash table

hash -r #Empty the hash table

Hash -d grep#Clear grep records in the hash table

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325002819&siteId=291194637