Linux tree Command Builder (Display Directory Tree)
The tree command displays directory contents in a tree structure in Linux. This interactive tree Command Builder helps you generate precise tree commands for visualizing directory hierarchies.
🚀 What is the tree Command?
The tree command allows you to:
- Visualize directory structures
- Display nested hierarchies
- Filter by file type
- Show file permissions and sizes
- Limit depth of recursion
- Colorize output
⚙️ Basic Syntax
tree [options] [DIRECTORY]🧠 How to Use This tree Command Builder
This tool helps you:
- Visualize directory layouts
- Filter to show only directories
- Limit depth of display
- Show detailed file information
- Generate a ready-to-use tree command
Workflow
- Specify starting directory (default: current)
- Choose display options (depth, file type)
- Optionally show permissions or sizes
- Copy generated command
🔧 Common tree Usage Patterns
Show Directory Tree
treeShow Specific Directory
tree /path/to/directoryDirectories Only
tree -dLimit to 2 Levels Deep
tree -L 2Show Permissions
tree -pShow File Sizes
tree -hFull Paths
tree -fWith Permissions and Sizes
tree -DhIgnore Specific Files/Directories
tree -I 'node_modules|.git'Colorized Output
tree -C🔧 Common Filtering Patterns
- Ignore
node_modules:-I 'node_modules' - Ignore multiple:
-I 'node_modules|.git|__pycache__' - Show only directories:
-d - Limit depth:
-L 2(2 levels)
✅ Pro Tips
- Use
-L 2to avoid overwhelming output on large trees - Combine
-Ito ignore build directories - Use
-Dhto see both dates and human file sizes - Use
-Jto output JSON format - Use
-Cto add colors for terminals