bash: Directory Stack Builtins
1
1 6.8.1 Directory Stack Builtins
1 ------------------------------
1
1 'dirs'
1 dirs [-clpv] [+N | -N]
1
1 Display the list of currently remembered directories. Directories
1 are added to the list with the 'pushd' command; the 'popd' command
1 removes directories from the list. The current directory is always
1 the first directory in the stack.
1
1 '-c'
1 Clears the directory stack by deleting all of the elements.
1 '-l'
1 Produces a listing using full pathnames; the default listing
1 format uses a tilde to denote the home directory.
1 '-p'
1 Causes 'dirs' to print the directory stack with one entry per
1 line.
1 '-v'
1 Causes 'dirs' to print the directory stack with one entry per
1 line, prefixing each entry with its index in the stack.
1 '+N'
1 Displays the Nth directory (counting from the left of the list
1 printed by 'dirs' when invoked without options), starting with
1 zero.
1 '-N'
1 Displays the Nth directory (counting from the right of the
1 list printed by 'dirs' when invoked without options), starting
1 with zero.
1
1 'popd'
1 popd [-n] [+N | -N]
1
1 When no arguments are given, 'popd' removes the top directory from
1 the stack and performs a 'cd' to the new top directory. The
1 elements are numbered from 0 starting at the first directory listed
1 with 'dirs'; that is, 'popd' is equivalent to 'popd +0'.
1
1 '-n'
1 Suppresses the normal change of directory when removing
1 directories from the stack, so that only the stack is
1 manipulated.
1 '+N'
1 Removes the Nth directory (counting from the left of the list
1 printed by 'dirs'), starting with zero.
1 '-N'
1 Removes the Nth directory (counting from the right of the list
1 printed by 'dirs'), starting with zero.
1
1 'pushd'
1 pushd [-n] [+N | -N | DIR]
1
1 Save the current directory on the top of the directory stack and
1 then 'cd' to DIR. With no arguments, 'pushd' exchanges the top two
1 directories and makes the new top the current directory.
1
1 '-n'
1 Suppresses the normal change of directory when rotating or
1 adding directories to the stack, so that only the stack is
1 manipulated.
1 '+N'
1 Brings the Nth directory (counting from the left of the list
1 printed by 'dirs', starting with zero) to the top of the list
1 by rotating the stack.
1 '-N'
1 Brings the Nth directory (counting from the right of the list
1 printed by 'dirs', starting with zero) to the top of the list
1 by rotating the stack.
1 'DIR'
1 Makes DIR be the top of the stack, making it the new current
1 directory as if it had been supplied as an argument to the
1 'cd' builtin.
1