How to stop bare bash cd (change directory command) from changing the working directory to $HOME?

wodow asked:

I do this too often:

$ pwd
$ cd # oops - meant to tab-complete something

Can cd defaulting to $HOME be disabled?

My answer:

In bash, if you accidentally change to the wrong directory, you can go back to the previous directory with:


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.