How can I return to the previous working directory quickly in Bash?

bash, shell

Solution

You can also do this

$ pushd ~/some_path
$ pushd /another_path
$ popd 
$ popd

Problem

When I change into a directory with the `cd` command, I lose the previous working directory, unless I remember it in my memory. Is there some handy method to go back quickly? Demo: ``` $ cd ~/some_path $ cd /another_path $ command_to_go_back_to_some_path ```

Original source