
Remember to invoke sudo to run the tree in a directory that requires root user access permissions. To list directory content in a tree-like format, navigate to the directory you want and run tree command without any options or arguments as follows. Once installed, you can proceed further to learn the tree command usage with examples as shown below.ġ. # dnf install tree #Fedora 22+ and /RHEL/CentOS 8 The tree command is available on all if not most Linux distributions, however, if you do not have it installed by default, use your default package manager to install it as shown. In this short article, we will show how to use the tree command with examples to recursively list the contents of a directory on a Linux system. It features various options for output manipulation, from file options, sorting options, to graphics options, and support for output in XML, JSON and HTML formats. The tree program is available in Unix and Unix-like systems such as Linux, as well as DOS, Windows, and many other operating systems. Read Also: dutree – A CLI Tool to Analyze Disk Usage in Coloured Output

It outputs the directory paths and files in each sub-directory and a summary of a total number of sub-directories and files. The tree is a tiny, cross-platform command-line program used to recursively list or display the content of a directory in a tree-like format.
