dirs
Quick Reference
Command Name:
dirs
Category:
file management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
Directory navigation
View and manage the directory stack for quick navigation
- 2
Multi-directory workflow
Efficiently work between multiple directories without typing full paths
- 3
Shell history
Track previously visited directories for easy return
- 4
Script path management
Manage directory context in shell scripts
Syntax
dirs [OPTION]
Options
Option | Description |
---|---|
-c |
Clear the directory stack, removing all entries |
-l |
Long format; display directory names in full without tilde substitution |
-p |
Print each directory in the stack on a separate line |
-v |
Print each directory in the stack with its position number |
+N |
Display the Nth entry from the left of the list (starting with zero) |
-N |
Display the Nth entry from the right of the list (starting with zero) |
Examples
How to Use These Examples
The examples below show common ways to use the dirs
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.