Linux/Unix – How to go to previous directory

To go to previous working directory is Linux is a frequently occurring need. These are two ways to achieve it:

  1. Using dash (-)
    $ cd -
  2. Using env variable OLDPWD
    $ cd $OLDPWD
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments