Linux Commands - hash command

by
Jeremy Canfield |
Updated: August 19 2020
| 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