NavigationCLI Reference
$tree
Display directory structure in a recursive visual tree diagram.
Syntax DefinitionPOSIX standard
tree [OPTIONS] [DIRECTORY]Try `tree` Live in Interactive Sandbox
Zero-install client simulation with real-time feedback.
bash — terminal
AST Sandbox (Free)
Overview & How tree Works
`tree` is a recursive directory listing program that produces a depth-indented visual tree of files and folders.
Common Flags & Command Options
| Flag / Option | Description |
|---|---|
| -L [level] | Max display depth of the directory tree. |
| -d | List directories only without listing files. |
| -a | All files are listed including hidden files. |
Practical Real-World Examples
Example #1Visualize directory tree up to depth 2
tree -L 2 /home/userOutputs folder tree hierarchy.
Frequently Asked Questions
How do you prevent tree from flooding your screen on big folders?
Use the `-L` flag (e.g., `tree -L 2`) to restrict visualization depth.
Related Linux Commands
$findFile Operations
Search for files and directories in a directory hierarchy based on name, type, size, or modification date.
$lsNavigation
List directory contents including file sizes, permissions, ownership, and modification timestamps.
$cdNavigation
Change the current working directory in the shell workspace.
$pwdNavigation
Print the absolute path of the current working directory.
$whichNavigation
Locate the executable binary path of a command in system PATH.