How to Change to the Previous Working Directory

By Lowell Heddings on July 30th, 2010

If you’ve switched into another folder with the cd command, and then want to get back to the previous one, you don’t have to remember the whole path. Just use the following command:

cd –

This will switch back to the previous directory. For instance, if you were in /var/www/vhosts/default and then switched to /etc, you could simply use the cd – command to switch back.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 07/30/10
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!