Best way to gain quick access to frequently used directory in linux terminal

Create a symbolic link in your home directory:

$ ln -s path/to/a/really/deeply/nested/director/my-project ~/my-project

$ cd ~/my-project

Add a variable in your .bashrc:

MYPROJECT=path/to/a/really/deeply/nested/director/my-project

to use:

$ cd $MYPROJECT

You can also take advantage of CDPATH variable.

And you could define a bash function in your $HOME/.bashrc like

 # in file ~/.bashrc
 function work() {
    cd $HOME/path/to/a/really/deeply/nested/director/my-project
 }

And recent bash or even better zsh may permit you things like

 cd **/my-project

Assuming you have only one deeply nested my-project/ directory in all your tree hierarchy. The ** is doing the equivalent of a find so can be slow.


Set the CDPATH variable: it contains additional directories to be searched when you run cd.


You can also try autojump.

It is like cd command but with the ability to learn. It maintains a database of directories you visit and assign weight to each entry.

Later you can use j foo to jump to a directory that contains foo in its name. If more than few directories have foo, it will show you a list of matches from where you can select your desired directory.