1TREE(1) General Commands Manual TREE(1)
2
3
4
6 tree - list contents of directories in a tree-like format.
7
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] [directory ...]
13
15 Tree is a recursive directory listing program that produces a depth
16 indented listing of files, which is colorized ala dircolors if the
17 LS_COLORS environment variable is set and output is to tty. With no
18 arguments, tree lists the files in the current directory. When direc‐
19 tory arguments are given, tree lists all the files and/or directories
20 found in the given directories each in turn. Upon completion of list‐
21 ing all files/directories found, tree returns the total number of files
22 and/or directories listed.
23
24 By default, when a symbolic link is encountered, the path that the sym‐
25 bolic link refers to is printed after the name of the link in the for‐
26 mat:
27
28 name -> real-path
29
30 If the `-l' option is given and the symbolic link refers to an actual
31 directory, then tree will follow the path of the symbolic link as if it
32 were a real directory.
33
34
36 Tree understands the following command line switches:
37
38
40 -a All files are printed. By default tree does not print hidden
41 files (those beginning with a dot `.'). In no event does tree
42 print the file system constructs `.' (current directory) and
43 `..' (previous directory).
44
45 -d List directories only.
46
47 -l Follows symbolic links if they point to directories, as if they
48 were directories. Symbolic links that will result in recursion
49 are avoided when detected.
50
51 -f Prints the full path prefix for each file.
52
53 -x Stay on the current file-system only. Ala find -xdev.
54
55 -L level
56 Max display depth of the directory tree.
57
58 -R Recursively cross down the tree each level directories (see -L
59 option), and at each of them execute tree again adding `-o
60 00Tree.html' as a new option.
61
62 -P pattern
63 List only those files that match the wild-card pattern. Note:
64 you must use the -a option to also consider those files begin‐
65 ning with a dot `.' for matching. Valid wildcard operators are
66 `*' (any zero or more characters), `?' (any single character),
67 `[...]' (any single character listed between brackets (optional
68 - (dash) for character range may be used: ex: [A-Z]), and
69 `[^...]' (any single character not listed in brackets) and `|'
70 separates alternate patterns.
71
72 -I pattern
73 Do not list those files that match the wild-card pattern.
74
75 --prune
76 Makes tree prune empty directories from the output, useful when
77 used in conjunction with -P or -I. See BUGS AND NOTES below for
78 more information on this option.
79
80 --noreport
81 Omits printing of the file and directory report at the end of
82 the tree listing.
83
84 --charset charset
85 Set the character set to use when outputting HTML and for line
86 drawing.
87
88 --filelimit #
89 Do not descend directories that contain more than # entries.
90
91 --timefmt format
92 Prints (implies -D) and formats the date according to the format
93 string which uses the strftime(3) syntax.
94
95 -o filename
96 Send output to filename.
97
99 -q Print non-printable characters in filenames as question marks
100 instead of the default.
101
102 -N Print non-printable characters as is instead of as escaped octal
103 numbers.
104
105 -Q Quote the names of files in double quotes.
106
107 -p Print the file type and permissions for each file (as per ls
108 -l).
109
110 -u Print the username, or UID # if no username is available, of the
111 file.
112
113 -g Print the group name, or GID # if no group name is available, of
114 the file.
115
116 -s Print the size of each file in bytes along with the name.
117
118 -h Print the size of each file but in a more human readable way,
119 e.g. appending a size letter for kilobytes (K), megabytes (M),
120 gigabytes (G), terabytes (T), petabytes (P) and exabytes (E).
121
122 --si Like -h but use SI units (powers of 1000) instead.
123
124 --du For each directory report its size as the accumulation of sizes
125 of all its files and sub-directories (and their files, and so
126 on). The total amount of used space is also given in the final
127 report (like the 'du -c' command.) This option requires tree to
128 read the entire directory tree before emitting it, see BUGS AND
129 NOTES below. Implies -s.
130
131 -D Print the date of the last modification time or if -c is used,
132 the last status change time for the file listed.
133
134 -F Append a `/' for directories, a `=' for socket files, a `*' for
135 executable files, a `>' for doors (Solaris) and a `|' for
136 FIFO's, as per ls -F
137
138 --inodes
139 Prints the inode number of the file or directory
140
141 --device
142 Prints the device number to which the file or directory belongs
143
145 -v Sort the output by version.
146
147 -r Sort the output in reverse alphabetic order.
148
149 -t Sort the output by last modification time instead of alphabeti‐
150 cally.
151
152 -c Sort the output by last status change instead of alphabetically.
153 Modifies the -D option (if used) to print the last status change
154 instead of modification time.
155
156 -U Do not sort. Lists files in directory order. Disables --dirs‐
157 first.
158
159 --dirsfirst
160 List directories before files. This is a meta-sort that alters
161 the above sorts. This option is disabled when -U is used.
162
164 -i Makes tree not print the indentation lines, useful when used in
165 conjunction with the -f option.
166
167 -A Turn on ANSI line graphics hack when printing the indentation
168 lines.
169
170 -S Turn on ASCII line graphics (useful when using Linux console
171 mode fonts). This option is now equivalent to `--charset=IBM437'
172 and may eventually be depreciated.
173
174 -n Turn colorization off always, over-ridden by the -C option.
175
176 -C Turn colorization on always, using built-in color defaults if
177 the LS_COLORS environment variable is not set. Useful to col‐
178 orize output to a pipe.
179
181 -X Turn on XML output. Outputs the directory tree as an XML format‐
182 ted file.
183
184 -H baseHREF
185 Turn on HTML output, including HTTP references. Useful for ftp
186 sites. baseHREF gives the base ftp location when using HTML
187 output. That is, the local directory may be `/local/ftp/pub',
188 but it must be referenced as `ftp://hostname.organiza‐
189 tion.domain/pub' (baseHREF should be `ftp://hostname.organiza‐
190 tion.domain'). Hint: don't use ANSI lines with this option, and
191 don't give more than one directory in the directory list. If you
192 wish to use colors via CCS style-sheet, use the -C option in
193 addition to this option to force color output.
194
195 -T title
196 Sets the title and H1 header string in HTML output mode.
197
198 --nolinks
199 Turns off hyperlinks in HTML output.
200
202 --help Outputs a verbose usage listing.
203
204 --version
205 Outputs the version of tree.
206
208 /etc/DIR_COLORS System color database.
209 ~/.dircolors Users color database.
210
211
213 LS_COLORS Color information created by dircolors
214 TREE_COLORS Uses this for color information over LS_COLORS if it is
215 set.
216 TREE_CHARSET Character set for tree to use in HTML mode.
217 LC_CTYPE Locale for filename output.
218 LC_TIME Locale for timefmt output, see strftime(3).
219 TZ Timezone for timefmt output, see strftime(3).
220
221
223 Steve Baker (ice@mama.indstate.edu)
224 HTML output hacked by Francesc Rocher (rocher@econ.udg.es)
225 Charsets and OS/2 support by Kyosuke Tokoro (NBG01720@nifty.ne.jp)
226
227
229 Tree does not prune "empty" directories when the -P and -I options are
230 used by default. Use the --prune option.
231
232 The -h and --si options round to the nearest whole number unlike the ls
233 implementations which rounds up always.
234
235 Pruning files and directories with the -I, -P and --filelimit options
236 will lead to incorrect file/directory count reports.
237
238 The --prune and --du options cause tree to accumulate the entire tree
239 in memory before emitting it. For large directory trees this can cause
240 a significant delay in output and the use of large amounts of memory.
241
242 The timefmt expansion buffer is limited to a ridiculously large 255
243 characters. Output of time strings longer than this will be undefined,
244 but are guaranteed to not exceed 255 characters.
245
246 XML trees are not colored, which is a bit of a shame.
247
248 Probably more.
249
250
252 dircolors(1), ls(1), find(1), du(1), strftime(3)
253
254
255
256Tree 1.6.0 TREE(1)