My Profile Photo

Sheogorath's Blog

popd and pushd

Today I learned about popd and pushd, which are command-line tools to switch directories while having your shell remember in a stack construct the order of the directory changes. Very similar to how cd - works to switch between the current and previous directory back and forth, pushd and popd allow to switch back and forth among as many directories as you like.

I came across this, while exploring a GitOps repository on GitHub that had some bootstrapping scripts using the popd command and I was curious what this command is and does.