Forrest logo
back to the dirs tool

dirs:tldr:7b366

dirs: Clear the directory stack.
$ dirs -c
try on your machine

The command "dirs -c" is used to clear the directory stack or history of previously visited directories in a command-line interface. Here's how it works:

In a command-line interface, when you navigate to different directories, a record of those directories is maintained in a stack-like structure called the directory stack or history. This allows you to easily switch between previously visited directories.

The "dirs" command is used to display the list of directories in the stack/history. By default, it shows the directories in the stack in a vertical list format, starting from the most recent directory and ending with the oldest.

The "-c" option is used with the "dirs" command to clear the directory stack or history. When you execute "dirs -c", it removes all the directories from the stack, essentially resetting the stack to empty.

Once the directory stack is cleared, you won't be able to use commands like "cd -" or "pushd" to navigate between previously visited directories anymore, as there won't be any record of those directories in the stack.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the dirs tool