5

How can I undo the last cd command?

view full story
linux-howto

http://askubuntu.com – Is there any way to jump back to the previous working directory after doing a cd to a different directory? My use-case is that I'm traversing a directory structure for a Java project, and I'm expecting that the current directory has only one sub-directory. So, I type cd and hit Tab and Enter rather quickly. However, the Tab failed, as I mistakenly expected one sub-directory, when in fact there are more. So now, I just executed cd, and am now in my home directory, instead of the Java project. Is there a way to "undo" this cd and jump back to the directory I was in? (HowTos)