pushdnamepushd[+n]pushd
The first form changes the working directory to
name
and adds it to the directory stack. The second form rotates the
n
th entry to the beginning, making it the working directory. (Entry numbers begin at 0.) With no arguments,
pushd
switches the first two entries and changes to the new current directory. See also
dirs
and
popd
.
%5dirs/home/bob /usr %6pushd /etcAdd /etc to directory stack /etc /home/bob /usr %7pushd +2Switch to third directory /usr /etc /home/bob %8pushdSwitch top two directories /etc /usr /home/bob %9popdDiscard current entry; go to next /usr /home/bob