Is there a way to go to any directory from any other directory directly? For example, lets say that I'm at root and I wanted to go directly to currentProject without doing:

cd dropbox/dev/currentProject



-root
  -dropbox
     -dev
        -currentProject

Is there way to do this?

link|improve this question

55% accept rate
feedback

5 Answers

up vote 19 down vote accepted

You can use something like autojump. Autojump lets you quickly jump to frequently visited directories with the j command.

For instance, once you've cd'd into your currentProject directory a few times, you can jump to it like this:

j currentProject

You can even use just part of the directory name. So you could do:

j current

To cd into currentProject.

link|improve this answer
feedback

This doesn't answer your question directly, but if I'm inferring correctly that you're going to be jumping between directories a lot, you could use a terminal multiplexer like GNU Screen to keep the different directories open in different windows, and simply switch between them as needed. I personally use Byobu, which adds some functionality on top of screen.

link|improve this answer
1  
See also: tmux. – Adam Backstrom May 23 '11 at 3:44
feedback

You can also add some common directories to your $CDPATH

export CDPATH=$HOME

This for example will let you cd into any dir in your home folder from anywhere in your system.

more

link|improve this answer
feedback

You can set an alias in your bash profile. Basically that lets you abbreviate a command with a word. You could set currentProject actually point to /dropbox/dev/currentProject

link|improve this answer
feedback

You could create symlinks in your home directory to where you want to go.

ln -s /dropbox/dev/currentProject ~/currentProject

This way, you're still using cd, but you don't have to remember the full path. Just use:

cd ~/currentProject

When you stop using the link, just delete it.

rm ~/currentProject
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.