Skip to content

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

  1. Specify starting directory (default: current)
  2. Choose display options (depth, file type)
  3. Optionally show permissions or sizes
  4. Copy generated command

🔧 Common tree Usage Patterns

Show Directory Tree

tree

Show Specific Directory

tree /path/to/directory

Directories Only

tree -d

Limit to 2 Levels Deep

tree -L 2

Show Permissions

tree -p

Show File Sizes

tree -h

Full Paths

tree -f

With Permissions and Sizes

tree -Dh

Ignore 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 2 to avoid overwhelming output on large trees
  • Combine -I to ignore build directories
  • Use -Dh to see both dates and human file sizes
  • Use -J to output JSON format
  • Use -C to add colors for terminals