Windows tree equivalent in Linux
Shows the directory structure as a visual tree. May need to be installed on Linux.
tree
tree
tree
tree
Overview
What this command does
On Windows, "tree" is used to display directory tree. On Linux, the closest practical mapping shown here is "tree". Shows the directory structure as a visual tree. May need to be installed on Linux. This reference is grouped under File Management → File System.
Windows → Linux context
What changes when you use this on Linux?
Same name, different environment
The basic command name tree is familiar on both platforms, but Linux path rules, quoting, permissions and available options can still change the result.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
For the broader concept behind this mapping, read Linux filesystem for Windows users.
Practical tasks
Common use cases
Display directory tree
Shows the directory structure as a visual tree. May need to be installed on Linux.
tree -L 2
Limit depth to 2 levels
tree -a
Include hidden files
tree -d
Show directories only
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
tree
tree -L 2
tree -d /home/user
sudo apt install tree
sudo dnf install tree
Walkthrough
Examples with explanations
# Windows: tree /f /a
tree # show current directory tree
tree -L 2 # limit to 2 levels deep
tree -d /home/user # directories only
# Install if missing:
sudo apt install tree # Debian/Ubuntu
sudo dnf install tree # Fedora/RHEL
Reference
Common options and variations
| Command or option | Use |
|---|---|
tree -L 2 | Limit depth to 2 levels |
tree -a | Include hidden files |
tree -d | Show directories only |
tree -h | Show human-readable file sizes |
tree -I 'node_modules' | Exclude a pattern |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "tree" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | tree |
Same command on this distribution. |
| Fedora | same command | tree |
Same command on this distribution. |
| Arch | same command | tree |
Same command on this distribution. |
Keep learning