How To Install Tree In Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

How To Install Tree In Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

tree

Show the contents of the current directory as a tree.

Maintainer: Florian Ernst



Section: utils

Install tree

  • Debian apt-get install tree Click to copy
  • Ubuntu apt-get install tree Click to copy
  • Alpine OS apk add tree Click to copy
  • Arch Linux pacman -S tree Click to copy
  • Kali Linux apt-get install tree Click to copy
  • CentOS yum install tree Click to copy
  • Fedora dnf install tree Click to copy
  • Raspbian apt-get install tree Click to copy
  • macOS brew install tree Click to copy

Show the contents of the current directory as a tree.

How to use tree?

Below are few example commands for tree that you can use in the terminal.

Show files and directories up to 'num' levels of depth (where 1 means the current directory):
tree -L numClick to copy
Show directories only:
tree -dClick to copy
Show hidden files too:
tree -aClick to copy
Print the tree without indentation lines, showing the full path instead (use `-N` to not escape whitespace and special characters):
tree -i -fClick to copy
Print the size of each node next to it, in human-readable format:
tree -s -hClick to copy
Filter the tree using a wildcard (glob) pattern:
tree -P *.txtClick to copy
Ignore entries that match a wildcard (glob) pattern:
tree -I *.txtClick to copy
To install the latest version of tree in your favorite operating system just copy the tree installation command from above and paste it into terminal. It will download and install the latest version of tree 2026 package in your OS.