2025-03-14 21:59:59 -06:00
|
|
|
# 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.
|
2025-07-24 22:27:13 -06:00
|
|
|
> See also: `pushd`, `popd`.
|
2025-03-14 21:59:59 -06:00
|
|
|
> More information: <https://www.gnu.org/software/bash/manual/bash.html#Directory-Stack-Builtins>.
|
|
|
|
|
|
|
|
|
|
- Display the directory stack with a space between each entry:
|
|
|
|
|
|
|
|
|
|
`dirs`
|
|
|
|
|
|
|
|
|
|
- Display the directory stack with one entry per line:
|
|
|
|
|
|
|
|
|
|
`dirs -p`
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
- Display a numbered list of entries in the directory stack:
|
|
|
|
|
|
|
|
|
|
`dirs -v`
|
|
|
|
|
|
|
|
|
|
- Display the directory stack without the tilde-prefix (`~`):
|
|
|
|
|
|
|
|
|
|
`dirs -l`
|
|
|
|
|
|
|
|
|
|
- Display only the `n`th entry in the directory stack, starting at 0 (Bash only):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`dirs +{{n}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
- Display only the `n`th entry in the directory stack from the last, starting at 0 (Bash only):
|
|
|
|
|
|
|
|
|
|
`dirs -{{n}}`
|
|
|
|
|
|
2025-03-14 21:59:59 -06:00
|
|
|
- Clear the directory stack:
|
|
|
|
|
|
|
|
|
|
`dirs -c`
|