Bash - pushd, popd, dirs
At first, "cd -" may be popular feature for bash's cd.
"cd -" make your directory to go back to the previous directory.
$ cd /tmp $ cd /etc $ pwd /etc $ cd - /tmp $ pwd /tmp
So, how about pushd, popd, dirs? These are bash build-in commands.
popd is to change the directory that is recorded by pushd.
The result of "dirs" is the list of recorded directories. The first element is always current directory.
The directory from second is the one that is recorded by pushd.
$ cd /var/log $ pushd . /var/log /var/log $ cd /tmp $ dirs /tmp /var/log $ cd /var $ cd ~ $ pwd /Users/jun.aruga $ popd /var/log $ pwd /var/log
But I the recorded directory is gone by typing "popd" at once.
I want to keep it, after changing the directory.