Linux: Change Directory or CD to the Previous Directory / Last Path

by Yang Yang on September 5, 2009

in Hosting Tips & Deals, Linux Server Administration Tips

cd is the command in Linux to change the current working directory. While you can change to your home directory by cd ~, you can change to the previous directory or last directory you were in by:

cd -

Which would come very handy when you are working across multiple directories back and forth. To change to the second last directory in the path history, simply add a slash:

cd --

Related Posts

Leave a Comment

Previous post:

Next post: