Ubuntu - Create a link to a specified directory so I can easily change to that directory

If you put a link in your home directory you can do

$ cd ~/myapp

It means typing two extra characters, but it'll work.

Or you could use environment variables and do

$ cd $MYAPP

Just set the CDPATH environment variable to .:/var/lib/tomcat6/webapps in your .[bash_]profile and you are set. Wherever you are, "cd myWar" will work as you expect it to do.


I keep a list of links in a folder in my home directory so that I can easily do:

cd ~/bm/myapp

Those "bookmarks" are generated and synchronized with the .gtk-bookmarks file (used by Nautilus and other GUI file managers) through the following shell script:

#!/bin/sh
sed 's/file:\/\/\(.*\)/\1/' $HOME/.gtk-bookmarks | while read dir name
do
 ln -s $dir $HOME/bm/$name
done