Display the directory stack.
dirs [-clpv] [+N] [-N]
-c Clear the directory stack by deleting all of the entries.
-l Produce a listing using full pathnames; 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.
+N (Optional): Displays the Nth entry counting from the left of the list printed by dirs when invoked without options, starting with zero.
-N (Optional): Displays the Nth entry counting from the right of the list printed by dirs when invoked without options, starting with zero.
Returns success unless an invalid option is provided or an error occurs.
# Add directories to the stack.
[user2@pc ~]$ dirs
~
[user2@pc ~]$ pushd -n ~/Desktop
~ ~/Desktop
[user2@pc ~]$ pushd -n ~/Pictures
~ ~/Pictures ~/Desktop
[user2@pc ~]$ pushd -n ~/bin
~ ~/bin ~/Pictures ~/Desktop
# Examples of options and parameters:
[user2@pc ~]$ dirs -l
/home/user2 /home/user2/bin /home/user2/Pictures /home/user2/Desktop
[user2@pc ~]$ dirs -p
~
~/bin
~/Pictures
~/Desktop
[user2@pc ~]$ dirs -v
0 ~
1 ~/bin
2 ~/Pictures
3 ~/Desktop
[user2@pc ~]$ dirs +2
~/Pictures
[user2@pc ~]$ dirs -2
~/bin
[user2@pc ~]$ dirs -c
[user2@pc ~]$ dirs
~
dirs, popd, and pushd.help command.