Back to Blog
Arnošt Havelka

The Dir Command

Master the art of listing files.

Start Interactive Lesson
The Dir Command

The dir command is your eyes in the terminal. It reveals what's inside any folder—files, subdirectories, sizes, dates, and more. With the right flags, you can filter, sort, and customize the output exactly how you need it.

Try the command

Try the commands to see how they work!

Build the command
dir
[drive:][path]The directory to list. Can include a specific drive, path, or a wildcard filter like *.txt.
Terminal
C:\Users\User>dir C:\Windows /a:h /s /o:n /p /w

Real-World Examples

Find all PDFs in your Documents folder:

Command Prompt
C:\Users\User>dir C:\Users\YourName\Documents\*.pdf /s

See hidden system files:

Command Prompt
C:\Users\User>dir /a

List files sorted by date (newest first):

Command Prompt
C:\Users\User>dir /o:-d

Knowledge Check

1 / 3

Which command lists ALL files, even hidden ones?

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

DIR Options - Command Switches

Learn how to use /? to discover command options