![Forrest logo](/images/logo.png)
dirs:tldr:33030
The "dirs" command is a built-in command in Unix-like operating systems, such as Linux. It is used to display the directory stack, which stores a list of recently visited directories.
When you navigate through different directories using commands like "cd" (change directory), the stack keeps track of the directories you have visited in the order of your navigation. The "dirs" command allows you to view this list.
By default, the "dirs" command shows the directories stored in the stack, each on a separate line, with the most recent directory at the top. The current directory (the one you are currently in) is represented by a dot (.). The output also includes some optional flags that modify how the command behaves, such as "-c" to clear the directory stack.
Additionally, you can use the numeric argument with "dirs" command to display only a subset of the directory stack. For example, "dirs +2" will show the second and subsequent directories from the stack, while "dirs -3" will show the last three directories in the stack.
Overall, the "dirs" command is useful for quickly checking the list of recently visited directories and navigating back to a specific directory without having to type the full path.