*! version July 26, 2018 @ 22:58:09

Title

pushd and popd -- Change directory, push current directory on stack, come back

Syntax

Change directory, keeping track of where you are now

pushd
dir

Go back to where you were

popd
[,
keep
]

Description

pushd is a generalization of cd. Just like cd, it changes
the working directory, but unlike cd, it saves the current directory.
You can then come back to the pushed directory by typing popd.

popd returns to the last directory left via pushd.

Options

keep tells popd to keep the directory being popped to on the stack. This is really only for debugging, so it isn't of much use.

Remarks

Sometimes it is worth jumping to a another directory to do a specific task, or to experiment without cluttering the current working directory.
When you want to do this, change to the other directory with pushd and come back with popd.

Example

Suppose you are currently working in the directory /Volumes/Secrets/Development/wickedgood, and want to jump over to /Users/yourname/Scratch to try an experiment. You can do this by

. pushd "/Users/yourname/Scratch"

. some experiments...

When finished with the experiments, you could then type

. popd

and you would pop back to /Volumes/Secrets/Development/wickedgood.
The good news is that you don't have to remember where you were or type out
the long directory name.

Author

Bill Rising, StataCorp

email: brising@stata.com

web: http://louabill.org