Skip to content

Tree cheatsheet

Basics

Show hidden files

tree -ah

Print file permissions

tree -p

Print owner and group

tree -ug

Pattern matching

Lists only those files that match the wild-card pattern

tree -P '*.sh'

Formatting

Output similar to ls -

tree -ughp --metafirst

Print full paths

tree -f

Print up to n levels deep

tree -L 3

Filtering

Exclude files from .gitignore

tree --gitignore