I have a command called gmx at these two paths:




how can I delete the bash hash for just one of them?

if I run:

hash -d gmx

which one is it deleting? Is it deleting both, or just the most recent value? Is this valid to delete a particular one?

hash -d  "/Users/alexamil/.nvm/versions/node/v9.2.0/bin/gmx"

Bash only remembers one path per name, so it will only have one path for gmx (at most). You can see which one that is by running

hash -t gmx


hash -d gmx

will delete any entry for gmx (the one shown by hash -t). The next time you try to run gmx, the shell will look for it in directories listed in your PATH, and store the first one it finds as the hash.

You can’t delete a particular value, but you can force a particular value, including one not on your PATH:

hash -p /usr/local/bin/gmx gmx

This will cause the shell to run /usr/local/bin/gmx when you type gmx.

See the Bash manual for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.