Bootstrap FreeKB - Linux Commands - hash command
Linux Commands - hash command

Updated:   |  Linux Commands articles

The hash command stores the path to commands that have been run in cache. If the hash table is empty, the following will be returned.

~]# hash
hash: hash table empty

 

Let's invoke a command,whoami.

~]# whoami
root

 

Now the hash command shows the absolute path to the whoami command.

~]# hash
hits    command
   1    /usr/bin/whoami

 

The -r flag can be used to empty the hash cache.

~]# hash -r

 

Or the -d option followed by a command can be used to remove a single command from the hash table.

~]# hash -d whoami

 

Now the hash table is empty again.

~]# hash
hash: hash table empty

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 774862 in the box below so that we can be sure you are a human.