| GNU Bash Reference Manual by Chet Ramey and Brian Fox Paperback (6"x9"), 180 pages ISBN 0954161777 RRP £19.95 ($29.95) "An essential resource .... the most detailed coverage available for all aspects of Bash" --- Linux User and Developer Magazine (Issue 37, Mar 2004) Get a printed copy>>> |
6.8.1 Directory Stack Builtins
dirs-
dirs [+N | -N] [-clpv]
Display the list of currently remembered directories. Directories are added to the list with thepushdcommand; thepopdcommand removes directories from the list.+N-
Displays the Nth directory (counting from the left of the
list printed by
dirswhen invoked without options), starting with zero. -N-
Displays the Nth directory (counting from the right of the
list printed by
dirswhen invoked without options), starting with zero. -c- Clears the directory stack by deleting all of the elements.
-l- Produces a longer listing; the default listing format uses a tilde to denote the home directory.
-p-
Causes
dirsto print the directory stack with one entry per line. -v-
Causes
dirsto print the directory stack with one entry per line, prefixing each entry with its index in the stack.
popd-
popd [+N | -N] [-n]
Remove the top entry from the directory stack, andcdto the new top directory. When no arguments are given,popdremoves the top directory from the stack and performs acdto the new top directory. The elements are numbered from 0 starting at the first directory listed withdirs; i.e.,popdis equivalent topopd +0.+N-
Removes the Nth directory (counting from the left of the
list printed by
dirs), starting with zero. -N-
Removes the Nth directory (counting from the right of the
list printed by
dirs), starting with zero. -n- Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
pushd-
pushd [dir | +N | -N] [-n]
Save the current directory on the top of the directory stack and thencdto dir. With no arguments,pushdexchanges the top two directories.+N-
Brings 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. -N-
Brings 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. -n- Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
dir-
Makes the current working directory be the top of the stack, and then
executes the equivalent of `
cddir'.cds to dir.
| ISBN 0954161777 | GNU Bash Reference Manual | See the print edition |