$dirstack
–
Directory Stack
$dirstack
contains the elements of the directory stack.
It does not contain the current working directory, in contrast to the dirs
builtin command.
Links
Examples
- Change working directory, print the directory stack, change back to the previous directory
- Output:
1 2 3 4
cd ~ pushd /usr/bin declare dirstack popd
1 2 3 4
/usr/bin ~ dirstack=( /home/user ) ~ /home/user
BashSupport Pro is a Zsh IDE with support for $dirstack – try it now!