snippetbashTip
dirs — Display or manipulate the directory stack. The directory stack is a list of recently visited directo
Viewed 0 times
thedirectorycommanddirsstackmanipulateclidisplay
Problem
How to use the
dirs command: Display or manipulate the directory stack. The directory stack is a list of recently visited directories that can be manipulated with the pushd and popd commands. See also: pushd, popd. More information: <https://www.gnu.org/software/bash/manual/bash.html#Directory-Stack-Builtins>.Solution
dirs — Display or manipulate the directory stack. The directory stack is a list of recently visited directories that can be manipulated with the pushd and popd commands. See also: pushd, popd. More information: <https://www.gnu.org/software/bash/manual/bash.html#Directory-Stack-Builtins>.Display the directory stack with a space between each entry:
dirsDisplay the directory stack with one entry per line:
dirs -pDisplay a numbered list of entries in the directory stack:
dirs -vDisplay the directory stack without the tilde-prefix (
~):dirs -lDisplay only the
nth entry in the directory stack, starting at 0 (Bash only):dirs +{{n}}Display only the
nth entry in the directory stack from the last, starting at 0 (Bash only):dirs -{{n}}Clear the directory stack:
dirs -cCode Snippets
Display the directory stack with a space between each entry
dirsDisplay the directory stack with one entry per line
dirs -pDisplay a numbered list of entries in the directory stack
dirs -vDisplay the directory stack without the tilde-prefix (`~`)
dirs -lDisplay only the `n`th entry in the directory stack, starting at 0 (Bash only)
dirs +{{n}}Context
tldr-pages: common/dirs
Revisions (0)
No revisions yet.