Switching betwen two directories in Bash

The pushd command remembers the last pushd’ed from directory
#cd /
#pushd /home
#pwd
/home
#pushd
#pwd
/

But quicker is “~-” which will simply take you back to the last working directory
#cd /
#cd /home
#pwd
/home
#cd ~-
#pwd
/

About these ads