Debian (or more correctly bash – and so every linux/unix that uses it has it) keeps a cache of commands that can throw off your day if you dont know about them. Its called the bash hash.
2 important commands explain everything
hash and hash -r
To see current commands that bash is cacheing with hash:
# hash
hits command
3 /usr/bin/dpkg
4 /usr/local/bin/pip
1 /usr/bin/aptitude
1 /usr/bin/dpkg-buildpackage
1 /bin/mv
1 /usr/bin/vi
2 /usr/bin/man
2 /usr/local/bin/btrfs
10 /bin/ls
1 /usr/local/bin/btrfsck
1 /usr/bin/python
5 /usr/bin/apt-get
To clear the cache
hash -r
To delete a single entry
hash -d <command name>
example:
hash -d ls
look at hash now and the line that said:
10 /bin/ls
will be missing. Next time ls runs it will go back in the cache.
Hash’s main purpose (save time not to have to look thru the paths for commands); That means that every time I type in any of these commands, they will be run from the mentioned paths. (even if there is another one thats better in another location). That has a negative side to it (hence you can clear cache).
Example of why hash can have a bad side (easily fixable): if you uninstall say python, which is currently here “/usr/bin/python” and install another version that lets say would randomly move to “/bin/python“. Then next time you type in “python” in bash, guess what… “/usr/bin/python not found!” thats because its in cache, to clear it simply: “hash -r” or “hash -d python“. Then running “python” will run it from the correct location (as long as its in the debian program search PATH) “/bin/python”
Lets say you ea