Tree (command)
| Company type | software utility |
|---|---|
| Industry | computing / software |
| Founder | Steve Baker (Linux version), Dave Dunfield (FreeDOS version), Asif Bahrainwala (ReactOS version) |
| Products | recursive directory listing tool |
In computing, the tree utility is a recursive directory listing tool or program that displays files and folders in a hierarchical, indented format. Initially developed for PC and MS-DOS environments, it is also incorporated into Digital Research FlexOS, IBM/Toshiba 4690 OS, PTS-DOS, FreeDOS, IBM OS/2, Microsoft Windows, and ReactOS. Additionally, a version compatible with Unix and Unix-like platforms is available.
The tree command has been misused in technical support fraud schemes where it fills the command prompt screen, allowing scammers to mimic output and mislead users.
Overview
Without any parameters, tree outputs the file structure of the current directory. When supplied with directory paths as arguments, it enumerates all files and folders contained within each specified location. Upon completion, the command reports the total count of directories and files. Users can modify output characters or enable colorization through various options.
This command has been part of the MS-DOS suite since version 3.2, included in IBM PC DOS starting from release 2, as well as in Digital Research’s DR DOS 6.0, Itautec’s SISNE plus, and Datalight’s ROM-DOS.
Steve Baker authored the Tree Command for Linux. The version for FreeDOS was developed by Dave Dunfield, while Asif Bahrainwala contributed the implementation for ReactOS. All these variants are distributed under the terms of the GNU General Public License.
On macOS, users can install tree using the Homebrew package manager as a formula.
Example
<syntaxhighlight lang="console"> $ tree path/to/folder/ path/to/folder/ ├── a-first.html ├── b-second.html ├── subfolder │ ├── readme.html │ ├── code.cpp │ └── code.h └── z-last-file.html
1 directories, 6 files </syntaxhighlight>