The pushd and popd commands on linux, and the "cd -" command

Опубликовано: 06 Сентябрь 2017
на канале: Chris Gregg
7,900
104

The pushd and popd commands use a stack to keep track of directories that you have been to. If you want to go to another directory and then return to it later, use the pushd command:

pushd ~

this goes to your home directory, and saves the directory you came from. If you later type the following:

popd

you will go back to that saved directory.

If you just want to go back to the prior directory you were in before a cd command, you can type:

cd -

and this takes you back there immediately.