This shell script creates a database of your directory accessing activity. And uses this database to figure out most used directories during last three days. You can easily modify this script to your taste. To use it, you have to source it into your bashrc. For example, if script (named cd.sh) is stored in ~/Scripts folder then add this line at the end of your ~/.bashrc file.
This will create a bash function 'c'. Instead for changing directory by 'cd' command, you have to use 'c'. (You can alias cd to c, though it is not recommended). Path can be passed fully to this command or a fragment of path can be passed. If nothing is given as argument, it will list the most used directories in last 3 days e.g.
dilawar@hobbes ~$
c
0 : /home/dilawar/Works/hpc21/bliff/Haskell
1 : /media/Public/DC/share/ThisIsWhatICallEntertainment/Friends/Season03
2 : /home/dilawar/Works/hpc21/verilogxml/Haskell
3 : /media/Public/DC/share/ThisIsWhatICallEntertainment/Friends
4 : /media/Public/DC/share/ThisIsWhatICallEntertainment/Friends/Season04
Give your choice [default 0] :
I can pass a fragment of path, like
dilawar@hobbes ~$
c Haskell
bash: cd: Haskell: No such file or directory
Search for matching ...
0 : /home/dilawar/Works/hpc21/bliff/Haskell
1 : /home/dilawar/Works/hpc21/verilogxml/Haskell
Give your choice [default 0] :
There is more than one path found matching with 'Haskell' therefore it provides a choice-list, if there was only one choice, it would simple change into that particular directory.
On technical note, command used to log entries into sqlite3 database are launched in a sub-shell. The parent shell does not slow down due to sqlite3 logging. It is as fast as cd command.
You should to install sqlite3.
--
Dilawar