formats

Bash Tips – Return to Previous Location

Published on May 1, 2011, by + in linux, osx, sysadmin.




Ok this is a quick one, but useful!

To return to the previous working directory, simply type:

cd -

and hit enter.

bash_previous


Cool!


One Response

  1. Tony

    Nice. I never knew that. That will save some keystrokes for sure.

    Maybe I’m a noob but I learned about sudo !! not long back.

    If you’ve never seen that, it just repeats your last command so if you tried to run a command but forgot to sudo first, just do sudo !! and save some keystrokes.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux Bash Tips – Return to Previous Location