I've a command in the ~/.local/bin/ path (lets call it dog). Calling the command with the full path ~/.local/bin/dog works as expected .

When I do which dog I get the expected ~/.local/bin/dog. When I check the $PATH ~/.local/bin is there as it should (actually it is /home/ec2-user/.local/bin)

But if simply type dog I get the following error:

-bash: /usr/local/bin/dog: No such file or directory

The output for type dog is dog is hashed (/usr/local/bin/dog) But for type -a dog is dog is /home/ec2-user/.local/bin/dog



1 Answer 1


Maybe you should run the command hash -r. From John1024's answer:

If you update your system and, as a result, some executable moves to a new location, the shell may get confused. The solution is to run hash -r which causes the shell to forget all the hashed locations and search the PATH from scratch.

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