← All commands
Topic hub File Management
Windows Linux File Management Expanded guide File System

Windows tree equivalent in Linux

Shows the directory structure as a visual tree. May need to be installed on Linux.

Windows tree
→
Linux equivalents
Debian/Ubuntu same command
tree
Fedora same command
tree
Arch same command
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.

Migration tip: <code>tree</code> may not be installed by default. Run <code>sudo apt install tree</code>. As an alternative, <code>find . | sort | sed</code> can approximate it without installing anything.

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.

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 optionUse
tree -L 2Limit depth to 2 levels
tree -aInclude hidden files
tree -dShow directories only
tree -hShow 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.

DistributionPackage manager / baseEquivalent commandDifference 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

Related File Management commands