CMD Master
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
Terminal
C:\Users\Student>dir
Directory of C:\Users\Student 04/11/2026 08:20 AM <DIR> . 04/11/2026 08:20 AM <DIR> .. 04/11/2026 08:20 AM <DIR> Documents 04/11/2026 08:20 AM <DIR> Downloads 04/11/2026 08:20 AM <DIR> Desktop 04/11/2026 08:20 AM 95 welcome.txt 04/11/2026 08:20 AM <DIR> Reports 04/11/2026 08:20 AM <DIR> Archive 04/11/2026 08:20 AM <DIR> Projects 1 File(s) 6 Dir(s)

Real-World Examples

Find all PDFs in your Documents folder:

Terminal
C:\Users\Student>dir C:\Users\YourName\Documents\*.pdf /S

See hidden system files:

Terminal
C:\Users\Student>dir /a

List files sorted by date (newest first):

Terminal
C:\Users\Student>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