man.lsPlain-English help for Unix commands

tree Show folders and files as an indented tree

Prints a folder and everything inside it as an indented tree, so you can see the whole layout at a glance. You reach for it to explain a project structure or to check what a folder contains several levels down. It ends with a count of directories and files.

Synopsis

tree [OPTION]... [DIRECTORY]...

Common options

Option or formWhat it does
-L LEVELLimit how many levels deep to go. -L 1 shows only the top level
-aInclude hidden files (names starting with a dot). They are skipped by default
-dList directories only, no files
-I PATTERNIgnore names matching a pattern. Separate several patterns with |, for example 'node_modules|.git'
-P PATTERNShow only files matching a pattern, such as '*.md'. Folders are still shown
-hPrint file sizes in human-readable form such as 4.0K
-fPrint the full path of each entry instead of just its name
--dirsfirstList folders before files

Examples

Show the current folder as a tree
tree
Only go two levels deep
tree -L 2
Folders only, to see the structure
tree -d -L 2 docs
Show sizes and list folders first
tree -h --dirsfirst photos
Show only Markdown files
tree -P '*.md' docs
Skip noisy folders in a code project
tree -a -I 'node_modules|.git' -L 3

Notes

See also

Last reviewed 2026-10-07.