Deleted command, but bash still sees it!
Deleted command, but bash still sees it!
⇐ Back to Shell

Questions, comments, or corrections? Send me a message.

Sometimes if you delete a command that you have run recently, for example say you just installed a new ssh, and the old binary was in /usr/bin but the new one is in /usr/local/bin. If you run ssh again, it will see the old one in /usr/bin still, so you delete it. But when you run ssh, you get:

bash: /usr/bin/ssh: No such file or directory
Well, duh, you just deleted it! The problem is, bash keeps an internal hash of recently executed command and their path so it doesn't have to search all of the directories in $PATH every time you execute it. You can view the contents of this with:
And you might see:
hits	command
   1	/bin/rm
   2	/home/psocccer/bin/foo
Or whatever you've been running. To get rid of any offending entries that may be outdated because you're in an upgrading frenzy, use hash -r. That tells bash to remove, or forget, everything in it's hash, so anything you run will be searched for in the path once again.