Bash - dirs (list of remembered directories)

About

Stack/list of remembered directories.

You can change of directories and return to the directory from which you came.

Syntax

dirs [-clpv] [+n] [-n]
  • Without options, displays the list of currently remembered directories.
  • +n Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero.
  • -n Displays the nth entry counting from the right of the list shown by dirs when invoked without options, starting with zero.
  • -c Clears the directory stack by deleting all of the entries.
  • -l Produces a longer listing; the default listing format uses a tilde to denote the home directory.
  • -p Print the directory stack with one entry per line.
  • -v Print the directory stack with one entry per line, prefixing each entry with its index in the stack.

Management

Return value

The return value is 0 unless an invalid option is supplied or n indexes beyond the end of the directory stack.

Display

The default display is on a single line with directory names separated by spaces.


Powered by ComboStrap