When you often work on command line and often need to change directories, this tip can save you a lot of time.

To navigate between current and previous directory, simply run:

cd -

And that’s it.

Running this command two times gets you to your original directory, effectively do not change your directory:

cd -
cd -

After these two commands, current directory is not changed.

If you need quickly to navigate between more than two directories, this tip cannot help you. For such case you need to find another solution.

Leave a Reply