Using pushd and popd could be helpful especially when you do some more cds or in scripts. If you simply want to switch between the current and the last directory, you could simply use cd -.
pushd
popd
cd
cd -
You can do this in Git as well; git checkout - switches back to the previous branch.
git checkout -
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Using
pushd
andpopd
could be helpful especially when you do some morecd
s or in scripts.If you simply want to switch between the current and the last directory, you could simply use
cd -
.You can do this in Git as well;
git checkout -
switches back to the previous branch.