Linux Commands - hash command

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


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


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |