Bash – Quick directory navigation in the bash shell

aliasbashcd-commandcommand lineshell

I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.

But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to switch to previously worked directories?

One solution I could think of is to add environment variables to my bash .profile for the frequently used directories and cd to them using those variables.

But is there any other solution to this?

Best Answer

If you're just switching between two directories, you can use cd - to go back and forth.

Related Question