How-To Geek
How to Change to the Previous Working Directory
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.
Got Feedback? Join the discussion at discuss.howtogeek.com
Comments (2)
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 07/30/10




Doesn´t work in windows. Do you know a similar command?
thanks