How can I undo the last cd command?
You can use cd -
to go back to your previous location, no matter where that was.
cd -
is great for going back one level, but if you find yourself wanting to go back a few levels, check out this script:
acd_func.sh
It's great. cd --
to see your history, and cd -3
to go back 3 levels, for example.
You can also use pushd
and popd
to utilize the directory stack :)
Some info here