| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 6.8.1 Directory Stack Builtins | Bash builtin commands to manipulate the directory stack. |
The directory stack is a list of recently-visited directories. The
pushd builtin adds directories to the stack as it changes
the current directory, and the popd builtin removes specified
directories from the stack and changes the current directory to
the directory removed. The dirs builtin displays the contents
of the directory stack.
The contents of the directory stack are also visible
as the value of the DIRSTACK shell variable.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dirsdirs [+N | -N] [-clpv] |
Display the list of currently remembered directories. Directories
are added to the list with the pushd command; the
popd command removes directories from the list.
+NDisplays the Nth directory (counting from the left of the
list printed by dirs when invoked without options), starting
with zero.
-NDisplays the Nth directory (counting from the right of the
list printed by dirs when invoked without options), starting
with zero.
-cClears the directory stack by deleting all of the elements.
-lProduces a longer listing; the default listing format uses a tilde to denote the home directory.
-pCauses dirs to print the directory stack with one entry per
line.
-vCauses dirs to print the directory stack with one entry per
line, prefixing each entry with its index in the stack.
popdpopd [+N | -N] [-n] |
Remove the top entry from the directory stack, and cd
to the new top directory.
When no arguments are given, popd
removes the top directory from the stack and
performs a cd to the new top directory. The
elements are numbered from 0 starting at the first directory listed with
dirs; i.e., popd is equivalent to popd +0.
+NRemoves the Nth directory (counting from the left of the
list printed by dirs), starting with zero.
-NRemoves the Nth directory (counting from the right of the
list printed by dirs), starting with zero.
-nSuppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
pushdpushd [dir | +N | -N] [-n] |
Save the current directory on the top of the directory stack
and then cd to dir.
With no arguments, pushd exchanges the top two directories.
+NBrings the Nth directory (counting from the left of the
list printed by dirs, starting with zero) to the top of
the list by rotating the stack.
-NBrings the Nth directory (counting from the right of the
list printed by dirs, starting with zero) to the top of
the list by rotating the stack.
-nSuppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
dirMakes the current working directory be the top of the stack, and then
executes the equivalent of `cd dir'.
cds to dir.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |