How to Install Tree on Linux?

The “tree” command is a powerful and versatile tool used in Linux to display the directory structure of a file system in an easy-to-read format. All the sub-directories and files of a directory can also be viewed using this utility. The user needs to install it before using it because it is not available by default in Linux.

This article will guide you to install the tree command in Linux.

  • Install tree on Debian/Ubuntu
  • Install tree on CentOS
  • Install tree on Fedora
  • Install tree on Arch Linux
  • Install tree on OpenSUSE

How to Install tree on Debian/Ubuntu?

This command doesn’t come pre-installed on any available Linux distribution. You can install it on Debian/Ubuntu by typing the below commands:

$ sudo apt install tree

How to Install tree on CentOS?

If you are using the CentOS distribution, you need to type the below command to install the tree package:

$ sudo yum install tree

How to Install tree on Fedora?

If you are using the Fedora distribution, you can install the Tree package by typing the below command:

$ sudo dnf install tree

How to Install tree on Arch Linux?

Similarly, you can install the Tree package on Arch Linux and Manjaro by typing the below command:

$ sudo pacman -s tree

How to Install tree on OpenSUSE?

The Tree package can also be installed on the OpenSUSE distribution of Linux by typing the below command:

$ sudo zypper install tree

Note: The commands written above apply to the distributions and their derivatives. i.e., the Debian/Ubuntu-based method can be followed to install the tree utility on LinuxMint/Kubuntu/Lubuntu.

Conclusion

To install the “tree” utility on Debian/Ubuntu, use the command “sudo apt install tree”. For CentOS, use “sudo yum install tree”; for Fedora, use “sudo dnf install tree”; for Arch-based, use “sudo pacman -s tree” and for OpenSUSE, use “sudo zypper install tree”. This post has briefly explained the commands to install the tree on Linux.