Display the list of currently remembered directories.
Syntax dirs [-clpv] [+n] [-n] Key +n Display the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero. -n Display the nth entry counting from the right of the list shown by dirs when invoked without options, starting with zero. -c Clear the directory stack by deleting all of the entries. -l Produce a longer listing; the default listing format using 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.
Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the pushd command; the popd command removes entries from the list.
The return value is 0 unless an invalid option is supplied or n indexes beyond the end of the directory stack.
dirs is a bash built in command.
“Women always worry about the things that men forget; men always worry about the things women remember”
Related macOS commands:
popd - Restore the previous value of the current directory
saved by `pushd'
pushd - Save and then change the current directory