Moving quickly from anywhere with $CDPATH

Tips Shell
September 27, 2006 | COMMENTS

Do you know the environment variable $CDPATH? This variable let you define some path where to look for a directories when moving with the command CD. You can define multiple path in this variable. This can be usefull if you have some directories that you access more frequently than the others. As this variable define the order how you move from a directory to another, I suggest you to keep the "." directory in first position of your variable declaration. Of course, you can set this variable in your .bashrc

nicolas@grimm:~$ export CDPATH=.:/:~/  
nicolas@grimm:~$ cd usr<br />
/usr<br />
nicolas@grimm:/usr$ cd Desktop<br />