to go back to the last directory use cd -
else you can use
Pushd allows you to specify the directory your about to move into. The syntax is exactly the same as cd, ie: pushd /anydir/anylocation/.
Popd allows you to jump directly back to the directory you just push'd from. The syntax is simply popd