How To Quickly Switch Back To Previous Directory When Using Linux Terminal

Share on FacebookShare on Google+Tweet about this on TwitterPin on PinterestShare on RedditPrint this page

One of the earlier posts described how to quickly switch to home directory when using Linux Terminal.

What if one needs to go back to the previous directory when using the Terminal?

Here is a simple way to do that :

Open Terminal and type :

cd -

The below example shows the initial directory as /home/avp/Music. To switch back to it from another directory, simply issue the command as mentioned.

Showing current working directory

Switching back to previous directory

This will quickly switch the current working directory to the previous directory that you were in .

Pretty nice when you need to switch back and forth between directories and get tired of typing “cd” all the time.


Comments are closed.