When to rehash executables in $PATH with bash

bashpath

Bash shell has a built-in command hash -r to reset the internal $PATH cache for executables.

When is it necessary to use this command?

Related: How to rehash executables in $PATH with bash

Best Answer

hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory.

So when the cached/stored information are not anymore updated or valid you may need to reset it.

Read more on this nice answer on Unix stackexchange.

Related Question