# Tree (command)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Tree_(command)
> Markdown URL: https://mediated.wiki/source/Tree_(command).md
> Source: https://en.wikipedia.org/wiki/Tree_(command)
> Source revision: 1334711810
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Shell command in various operating systems}}
{{lowercase title}}
{{Infobox software
| name                   = tree
| logo                   = 
| screenshot             = ReactOS-0.4.13 tree command 667x434.png
| screenshot size        = 
| caption                = The [ReactOS](/source/ReactOS) <code>tree</code> command
| developer              = Steve Baker, [DR](/source/Digital_Research), [Microsoft](/source/Microsoft), [IBM](/source/IBM), [Itautec](/source/Itautec), [Datalight](/source/Datalight), [Toshiba](/source/Toshiba), Dave Dunfield, Asif Bahrainwala
| released               = 
| latest release version = 
| latest release date    = 
| programming language   = [Unix-like](/source/Unix-like), [FreeDOS](/source/FreeDOS), [ReactOS](/source/ReactOS): [C](/source/C_(programming_language))
| operating system       = [Unix](/source/Unix), [Unix-like](/source/Unix-like), [MS-DOS](/source/MS-DOS), [PC DOS](/source/IBM_PC_DOS), [FlexOS](/source/FlexOS), [SISNE plus](/source/SISNE_plus), [ROM-DOS](/source/ROM-DOS), [4690 OS](/source/4690_Operating_System), [PTS-DOS](/source/PTS-DOS), [OS/2](/source/OS%2F2), [eComStation](/source/eComStation), [ArcaOS](/source/ArcaOS), [Windows](/source/Microsoft_Windows), [DR DOS](/source/DR_DOS), [FreeDOS](/source/FreeDOS), [ReactOS](/source/ReactOS)
| platform               = [Cross-platform](/source/Cross-platform)
| genre                  = [Command](/source/Command_(computing))
| license                = Unix, Unix-like, FreeDOS, ReactOS: [GPLv2](/source/GPLv2)
| website                = 
}}
In [computing](/source/computing), '''<code>tree</code>''' is a recursive [directory](/source/directory_(computing)) listing [command](/source/command_(computing)) or [program](/source/Computer_program) that produces a depth-indented listing of files. Originating in PC- and [MS-DOS](/source/MS-DOS), it is found in [Digital Research](/source/Digital_Research) [FlexOS](/source/FlexOS),<ref>{{cite book|url=http://www.bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf|title=FlexOS User's Guide|edition=Version 1.3|date=November 1986|publisher=[Digital Research](/source/Digital_Research)|id=1073-2003-001|access-date=2018-09-16|archive-date=2019-09-25|archive-url=https://web.archive.org/web/20190925131719/http://bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf|url-status=dead}}</ref> [IBM](/source/IBM)/[Toshiba](/source/Toshiba) [4690 OS](/source/4690_Operating_System),<ref>{{Cite web |title=Users Guide |url=https://archive.org/details/4690OSV6r2UsersGuide/page/n169 |website=archive.org}}{{dead link|date=May 2024}}</ref> [PTS-DOS](/source/PTS-DOS),<ref>
{{cite web |title=PTS-DOS 2000 Pro User Manual |publisher=[Paragon Technology GmbH](/source/Paragon_Technology_GmbH) |location=Buggingen, Germany |date=1999 |url=http://download.paragon-software.com/doc/manual_dos_eng.pdf |access-date=2018-05-12 |url-status=live |archive-url=https://web.archive.org/web/20180512094512/http://download.paragon-software.com/doc/manual_dos_eng.pdf |archive-date=2018-05-12}}</ref> [FreeDOS](/source/FreeDOS),<ref>{{cite web|url=http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-base.html|title=FreeDOS group -- FreeDOS Base|work=FreeDOS on ibiblio.org}}</ref> IBM [OS/2](/source/OS%2F2),<ref>{{cite web|url=http://www.jatomes.com/Help/Os2Cmd.php#TREE|title=JaTomes Help - OS/2 Commands|access-date=2019-07-27|archive-date=2019-04-14|archive-url=https://web.archive.org/web/20190414130029/http://www.jatomes.com/Help/Os2Cmd.php#TREE|url-status=dead}}</ref> [Microsoft Windows](/source/Microsoft_Windows),<ref>{{cite web|url=https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/tree|title=Tree|website=Microsoft Docs|date=3 February 2023 }}</ref> and [ReactOS](/source/ReactOS). A version for [Unix](/source/Unix) and [Unix-like](/source/Unix-like) systems is also available.

The <code>tree</code> command is frequently used as part of a [technical support scam](/source/technical_support_scam), where the command is used to occupy the command prompt screen, while the scammer, pretending to be technical support, types additional text that is supposed to look like output of the command.<ref>{{Cite web|url=https://www.tripwire.com/state-of-security/featured/the-world-of-the-technical-support-scam/|title=The World of the Technical Support Scam|date=2016-11-09|website=The State of Security|language=en-US|access-date=2019-12-29}}</ref>

==Overview==
With no arguments, <code>tree</code> lists the files in the [current directory](/source/working_directory). When directory arguments are given, <code>tree</code> lists all the files or directories found in the given directories each in turn. Upon completion of listing all files and directories found, <code>tree</code> returns the total number of files and directories listed. There are options to change the characters used in the output, and to use color output.<ref>{{man|1|tree|die.net}}</ref>

The command is available in [MS-DOS](/source/MS-DOS) versions 3.2 and later and [IBM PC DOS](/source/IBM_PC_DOS) releases 2 and later.<ref name="RUNNINGMSDOS">{{Cite book|author-last=Wolverton|author-first=Van|title=Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition|date=2003|publisher=[Microsoft Press](/source/Microsoft_Press)|isbn=0-7356-1812-7}}</ref> [Digital Research](/source/Digital_Research) [DR DOS 6.0](/source/DR_DOS_6.0),<ref name="drdos6userguide">[https://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf DR DOS 6.0 User Guide Optimisation and Configuration Tips]</ref> [Itautec](/source/Itautec) [SISNE plus](/source/SISNE_plus),<ref name="SISNE_plus">{{cite web |author=Itautec |author-link=Itautec |date=2015-05-14 |title=SISNE plus - Referência Sumária |trans-title=SISNE plus - Quick Reference Manual |url=https://datassette.org/manuais/ibm-pc/sisne-plus-referencia-sumaria |url-status=live |archive-url=https://web.archive.org/web/20190928211058/https://datassette.org/manuais/ibm-pc/sisne-plus-referencia-sumaria |archive-date=2019-09-28 |access-date=2020-01-12 |work=Datassette |language=pt |id=COD 23987-01-4}} [https://web.archive.org/web/20190928211109/http://files3.datassette.org/manuais/sisne_plus_referencia_sumaria.pdf] (86 pages)</ref> and [Datalight](/source/Datalight) [ROM-DOS](/source/ROM-DOS)<ref>{{Cite web|url=https://www.datalight.com/assets/files/ROM-DOS_Users_Guide.pdf|title=Datalight ROM-DOS User's Guide|website=www.datalight.com}}</ref> include an implementation of the {{code|tree}} command.

The ''Tree Command for Linux'' was developed by Steve Baker.<ref>{{Cite web |last=Baker |first=Steve |title=Home - Old Man Programmer |url=https://oldmanprogrammer.net/source.php?dir=projects/tree |access-date=2024-01-26}}</ref> The [FreeDOS](/source/FreeDOS) version was developed by Dave Dunfield<ref>{{cite web|url=http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/tree.html|title= FreeDOS Package -- Tree (FreeDOS Base)|work=FreeDOS on ibiblio.org}}</ref> and the [ReactOS](/source/ReactOS) version was developed by Asif Bahrainwala.<ref>{{GitHub|https://github.com/reactos/reactos/blob/master/base/applications/cmdutils/tree/tree.c}}</ref> All three implementations are licensed under the [GNU General Public License](/source/GNU_General_Public_License).

The Tree command is also available in [macOS](/source/macOS) as a formula installed via the command line [Homebrew](/source/Homebrew_(package_manager)) package manager.<ref name="HM tree info 1">{{cite web|url=https://formulae.brew.sh/formula/tree|title=Homebrew - Tree (Formala)|work=Homebrew|access-date=2024-05-14}}</ref>

==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>

==See also==
* [dir](/source/dir_(command))
* [ls](/source/ls)
* [pstree](/source/pstree)
* [List of Unix commands](/source/List_of_Unix_commands)
* [List of DOS commands](/source/List_of_DOS_commands)

==References==
{{Reflist}}

==Further reading==
*{{Cite book|author-last=Cooper|author-first=Jim|title=Special Edition Using MS-DOS 6.22, Third Edition|date=2001|publisher=[Que Publishing](/source/Que_Publishing)|isbn=978-0789725738}}
*{{Cite book|author1=Kathy Ivens|author2=Brian Proffit|year=1993|title=OS/2 Inside & Out|publisher=[Osborne McGraw-Hill](/source/Osborne_McGraw-Hill)|isbn=978-0078818714}}
*{{Cite book|author=John Paul Mueller|year=2007|title=Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000|publisher=[John Wiley & Sons](/source/Wiley_(publisher))|isbn=978-0470165799}}

==External links==
{{Wikibooks|Guide to Windows Commands}}
*[http://mama.indstate.edu/users/ice/tree/ The Tree Command for Linux Homepage] {{Webarchive|url=https://web.archive.org/web/20210322221103/http://mama.indstate.edu/users/ice/tree/ |date=2021-03-22 }} [https://gitlab.com/OldManProgrammer/unix-tree New repository]
*[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/tree tree | Microsoft Docs]

{{Unix commands}}
{{Windows commands}}

Category:External DOS commands
Category:OS/2 commands
Category:ReactOS commands
Category:Unix file system-related software
Category:Windows commands

---
Adapted from the Wikipedia article [Tree (command)](https://en.wikipedia.org/wiki/Tree_(command)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Tree_(command)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
