2-cent Tip: Caching in the Shell
Amit k. Saha [amitsaha.in at gmail.com]
Wed, 16 Jul 2008 15:04:37 +0530
Just wanted to share this with you: (I am sure most of you already know this)
Shells cache the commands which you have executed so as to save the time required to search your PATH every time you execute it. Type 'hash' in your terminal and you will see something like:
$ hash hits command 1 /usr/bin/which 2 /usr/local/bin/log4cpp-config 1 /usr/bin/gnome-screensaver
Every time you execute a (non shell-builtin) command, it is automatically added to the 'cache' and lives there for the rest of the session- once you logout or even close the pseudo-terminal (like gnome-terminal) it is gone.
Another observation, the most recently executed command is added to the bottom of the list.
Happy to share!
I found this a good read: http://crashingdaily.wordpress.com/2008/04/21/hashing-the-executables-a-look-at-hash-and-type/
-- Amit Kumar Saha http://blogs.sun.com/amitsaha/ http://amitksaha.blogspot.com Skype: amitkumarsaha