1TREE(1)                     General Commands Manual                    TREE(1)
2
3
4

NAME

6       tree - list contents of directories in a tree-like format.
7

SYNOPSIS

9       tree  [-acdfghilnpqrstuvxACDFQNSUX]  [-L  level [-R]] [-H baseHREF] [-T
10       title] [-o filename] [--nolinks] [-P pattern] [-I  pattern]  [--inodes]
11       [--device] [--noreport] [--dirsfirst] [--version] [--help] [--filelimit
12       #] [--si] [--prune] [--du] [--timefmt  format]  [--matchdirs]  [--from‐
13       file] [--] [directory ...]
14
15

DESCRIPTION

17       Tree  is  a  recursive  directory listing program that produces a depth
18       indented listing of files, which is  colorized  ala  dircolors  if  the
19       LS_COLORS  environment  variable  is set and output is to tty.  With no
20       arguments, tree lists the files in the current directory.  When  direc‐
21       tory  arguments  are given, tree lists all the files and/or directories
22       found in the given directories each in turn.  Upon completion of  list‐
23       ing all files/directories found, tree returns the total number of files
24       and/or directories listed.
25
26       By default, when a symbolic link is encountered, the path that the sym‐
27       bolic  link refers to is printed after the name of the link in the for‐
28       mat:
29
30           name -> real-path
31
32       If the `-l' option is given and the symbolic link refers to  an  actual
33       directory, then tree will follow the path of the symbolic link as if it
34       were a real directory.
35
36

OPTIONS

38       Tree understands the following command line switches:
39
40

LISTING OPTIONS

42       -a     All files are printed.  By default tree does  not  print  hidden
43              files  (those  beginning with a dot `.').  In no event does tree
44              print the file system constructs  `.'  (current  directory)  and
45              `..' (previous directory).
46
47       -d     List directories only.
48
49       -l     Follows  symbolic links if they point to directories, as if they
50              were directories. Symbolic links that will result  in  recursion
51              are avoided when detected.
52
53       -f     Prints the full path prefix for each file.
54
55       -x     Stay on the current file-system only.  Ala find -xdev.
56
57       -L level
58              Max display depth of the directory tree.
59
60       -R     Recursively  cross  down the tree each level directories (see -L
61              option), and at each of  them  execute  tree  again  adding  `-o
62              00Tree.html' as a new option.
63
64       -P pattern
65              List  only  those files that match the wild-card pattern.  Note:
66              you must use the -a option to also consider those  files  begin‐
67              ning with a dot `.'  for matching.  Valid wildcard operators are
68              `*' (any zero or more characters), `?' (any  single  character),
69              `[...]'  (any single character listed between brackets (optional
70              - (dash) for character  range  may  be  used:  ex:  [A-Z]),  and
71              `[^...]'  (any  single character not listed in brackets) and `|'
72              separates alternate patterns.
73
74       -I pattern
75              Do not list those files that match the wild-card pattern.
76
77       --ignore-case
78              If a match pattern is specified by the -P  or  -I  option,  this
79              will  cause  the pattern to match without regards to the case of
80              each letter.
81
82       --matchdirs
83              If a match pattern is specified by  the  -P  option,  this  will
84              cause  the pattern to be applied to directory names (in addition
85              to filenames).  In the event of a match on the  directory  name,
86              matching  is  disabled  for  the  directory's  contents.  If the
87              --prune option is used, empty folders  that  match  the  pattern
88              will not be pruned.
89
90       --prune
91              Makes  tree prune empty directories from the output, useful when
92              used in conjunction with -P or -I.  See BUGS AND NOTES below for
93              more information on this option.
94
95       --noreport
96              Omits  printing  of  the file and directory report at the end of
97              the tree listing.
98
99       --charset charset
100              Set the character set to use when outputting HTML and  for  line
101              drawing.
102
103       --filelimit #
104              Do not descend directories that contain more than # entries.
105
106       --timefmt format
107              Prints (implies -D) and formats the date according to the format
108              string which uses the strftime(3) syntax.
109
110       -o filename
111              Send output to filename.
112

FILE OPTIONS

114       -q     Print non-printable characters in filenames  as  question  marks
115              instead of the default.
116
117       -N     Print non-printable characters as is instead of as escaped octal
118              numbers.
119
120       -Q     Quote the names of files in double quotes.
121
122       -p     Print the file type and permissions for each  file  (as  per  ls
123              -l).
124
125       -u     Print the username, or UID # if no username is available, of the
126              file.
127
128       -g     Print the group name, or GID # if no group name is available, of
129              the file.
130
131       -s     Print the size of each file in bytes along with the name.
132
133       -h     Print  the  size  of each file but in a more human readable way,
134              e.g. appending a size letter for kilobytes (K),  megabytes  (M),
135              gigabytes (G), terabytes (T), petabytes (P) and exabytes (E).
136
137       --si   Like -h but use SI units (powers of 1000) instead.
138
139       --du   For  each directory report its size as the accumulation of sizes
140              of all its files and sub-directories (and their  files,  and  so
141              on).   The total amount of used space is also given in the final
142              report (like the 'du -c' command.) This option requires tree  to
143              read  the entire directory tree before emitting it, see BUGS AND
144              NOTES below.  Implies -s.
145
146       -D     Print the date of the last modification time or if -c  is  used,
147              the last status change time for the file listed.
148
149       -F     Append  a `/' for directories, a `=' for socket files, a `*' for
150              executable files, a `>'  for  doors  (Solaris)  and  a  `|'  for
151              FIFO's, as per ls -F
152
153       --inodes
154              Prints the inode number of the file or directory
155
156       --device
157              Prints the device number to which the file or directory belongs
158

SORTING OPTIONS

160       -v     Sort the output by version.
161
162       -t     Sort  the output by last modification time instead of alphabeti‐
163              cally.
164
165       -c     Sort the output by last status change instead of alphabetically.
166              Modifies the -D option (if used) to print the last status change
167              instead of modification time.
168
169       -U     Do not sort.  Lists files in directory order.  Disables  --dirs‐
170              first.
171
172       -r     Sort  the  output  in  reverse  order.  This is a meta-sort that
173              alter the above sorts.  This option is disabled when -U is used.
174
175       --dirsfirst
176              List directories before files. This is a meta-sort  that  alters
177              the above sorts.  This option is disabled when -U is used.
178
179       --sort[=]type
180              Sort  the  output  by type instead of name. Possible values are:
181              ctime (-c), mtime (-t), size, or version (-v).
182
183

GRAPHICS OPTIONS

185       -i     Makes tree not print the indentation lines, useful when used  in
186              conjunction with the -f option.  Also removes as much whitespace
187              as possible when used with the -J or -x options.
188
189       -A     Turn on ANSI line graphics hack when  printing  the  indentation
190              lines.
191
192       -S     Turn  on  CP437  line  graphics (useful when using Linux console
193              mode fonts). This option is now equivalent to `--charset=IBM437'
194              and may eventually be depreciated.
195
196       -n     Turn colorization off always, over-ridden by the -C option.
197
198       -C     Turn  colorization  on  always, using built-in color defaults if
199              the LS_COLORS or TREE_COLORS environment variables are not  set.
200              Useful to colorize output to a pipe.
201

XML/JSON/HTML OPTIONS

203       -X     Turn on XML output. Outputs the directory tree as an XML format‐
204              ted file.
205
206       -J     Turn on JSON output. Outputs the directory tree as an JSON  for‐
207              matted array.
208
209       -H baseHREF
210              Turn  on  HTML output, including HTTP references. Useful for ftp
211              sites.  baseHREF gives the base ftp  location  when  using  HTML
212              output.  That  is,  the local directory may be `/local/ftp/pub',
213              but  it  must   be   referenced   as   `ftp://hostname.organiza‐
214              tion.domain/pub'  (baseHREF  should be `ftp://hostname.organiza‐
215              tion.domain'). Hint: don't use ANSI lines with this option,  and
216              don't give more than one directory in the directory list. If you
217              wish to use colors via CSS style-sheet, use  the  -C  option  in
218              addition to this option to force color output.
219
220       -T title
221              Sets the title and H1 header string in HTML output mode.
222
223       --nolinks
224              Turns off hyperlinks in HTML output.
225

INPUT OPTIONS

227       --fromfile  Reads a directory listing from a file rather than the file-
228       system.  Paths provided on the command line  are  files  to  read  from
229       rather  than  directories  to  search.  The dot (.) directory indicates
230       that tree should read paths from standard input.
231
232

MISC OPTIONS

234       --help Outputs a verbose usage listing.
235
236       --version
237              Outputs the version of tree.
238
239       --     Option processing terminator.  No further options will  be  pro‐
240              cessed after this.
241

FILES

243       /etc/DIR_COLORS          System color database.
244       ~/.dircolors        Users color database.
245
246

ENVIRONMENT

248       LS_COLORS      Color information created by dircolors
249       TREE_COLORS    Uses  this for color information over LS_COLORS if it is
250       set.
251       TREE_CHARSET   Character set for tree to use in HTML mode.
252       CLICOLOR       Enables colorization even if TREE_COLORS or LS_COLORS is
253       not set.
254       CLICOLOR_FORCE Always enables colorization (effectively -C)
255       LC_CTYPE       Locale for filename output.
256       LC_TIME        Locale for timefmt output, see strftime(3).
257       TZ        Timezone for timefmt output, see strftime(3).
258
259

AUTHOR

261       Steve Baker (ice@mama.indstate.edu)
262       HTML output hacked by Francesc Rocher (rocher@econ.udg.es)
263       Charsets and OS/2 support by Kyosuke Tokoro (NBG01720@nifty.ne.jp)
264
265

BUGS AND NOTES

267       Tree  does not prune "empty" directories when the -P and -I options are
268       used by default. Use the --prune option.
269
270       The -h and --si options round to the nearest whole number unlike the ls
271       implementations which rounds up always.
272
273       Pruning  files  and directories with the -I, -P and --filelimit options
274       will lead to incorrect file/directory count reports.
275
276       The --prune and --du options cause tree to accumulate the  entire  tree
277       in  memory before emitting it. For large directory trees this can cause
278       a significant delay in output and the use of large amounts of memory.
279
280       The timefmt expansion buffer is limited to  a  ridiculously  large  255
281       characters.  Output of time strings longer than this will be undefined,
282       but are guaranteed to not exceed 255 characters.
283
284       XML/JSON trees are not colored, which is a bit of a shame.
285
286       Probably more.
287
288

SEE ALSO

290       dircolors(1), ls(1), find(1), du(1), strftime(3)
291
292
293
294Tree 1.8.0                                                             TREE(1)
Impressum