These two commands replace 'cd' and work with a directory stack of different paths.
$ pushd tmp # cd to tmp and remember current path /
/tmp /
$ pwd
/tmp
$ cd /usr # normal cd to wherever you want...
$ pwd
/usr
$ popd # pop the stck and get back to the previous path
/
$ pwd
/
Subsequent pushd will stack multiple paths.
It's a built-in of bash and other shells. It works even with Windows' cmd.exe
Comments (395) 107 threads
Show all comments
Showing thread 35 of 107
These two commands replace 'cd' and work with a directory stack of different paths.
Subsequent pushd will stack multiple paths.It's a built-in of bash and other shells. It works even with Windows' cmd.exe