•Arnošt Havelka
Tree Command
Visualize directory structures graphically.
Start Interactive LessonThe tree command allows you to view the folder structure of a drive or path graphically. It creates a "branching" visualization that makes it easy to understand the hierarchy of your directories and files.
Try the command
Visualize the folder structure!
Build the command
tree
Terminal
C:\Users\Student>tree
Folder PATH listing
Volume serial number is 0000-0000
C:\Users\Student
├───Desktop
├───Documents
├───Downloads
Common Options
- /F: By default,
treeonly shows folders. Use/fto see files inside those folders as well. - /A: If you are sending the output to a text file or a printer that doesn't support graphical lines,
/aforcestreeto use standard text characters (+, -, |, ).
Real-World Examples
1. Basic Directory Tree
View the structure of the current directory.
Terminal
C:\Users\Student>tree
2. Showing Files
See exactly where files are located within the structure.
Terminal
C:\Users\Student>tree /f
3. Saving the Tree to a File
This is great for documenting your project structure.
Terminal
C:\Users\Student>tree /f > structure.txt
Knowledge Check
1 / 2Which flag makes tree show files, not just folders?
References
These documentation links provide authoritative details for the commands used in this article.
Up Next
Find Command
Search for specific text strings within files.