Quick Change to Previous Directory on Command Line

Chris Simpkins
sweetmeat
Published in
1 min readOct 10, 2017
photo by John Baker https://unsplash.com/photos/3To9V42K0Ag

This is a short command line idiom that takes you back to your previous directory on *nix platforms.

Change Directory to Previous Directory

$ cd -

Shell Support

I can verify that it works in the following shells:

  • bash
  • zsh

Source

--

--