1TREE(1) General Commands Manual TREE(1)
2
3
4
6 tree - list contents of directories in a tree-like format.
7
9 tree [-adfghilnopqrstuvxACDFNS] [-L level [-R]] [-H baseHREF] [-T
10 title] [-o filename] [--nolinks] [-P pattern] [-I pattern] [--inodes]
11 [--device] [--noreport] [--dirsfirst] [--version] [--help] [--filelimit
12 #] [directory ...]
13
15 Tree is a recursive directory listing program that produces a depth
16 indented listing of files. Color is supported ala dircolors if the
17 LS_COLORS environment variable is set, output is to a tty, and the -C
18 flag is used. With no arguments, tree lists the files in the current
19 directory. When directory arguments are given, tree lists all the
20 files and/or directories found in the given directories each in turn.
21 Upon completion of listing all files/directories found, tree returns
22 the total number of files 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
39 --help Outputs a verbose usage listing.
40
41 --version
42 Outputs the version of tree.
43
44 -a All files are printed. By default tree does not print hidden
45 files (those beginning with a dot `.'). In no event does tree
46 print the file system constructs `.' (current directory) and
47 `..' (previous directory).
48
49 -d List directories only.
50
51 -f Prints the full path prefix for each file.
52
53 -i Makes tree not print the indentation lines, useful when used in
54 conjunction with the -f option.
55
56 -l Follows symbolic links if they point to directories, as if they
57 were directories. Symbolic links that will result in recursion
58 are avoided when detected.
59
60 -x Stay on the current file-system only. Ala find -xdev.
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 --noreport
76 Omits printing of the file and directory report at the end of
77 the tree listing.
78
79 -p Print the file type and permissions for each file (as per ls
80 -l).
81
82 -s Print the size of each file in bytes along with the name.
83
84 -h Print the size of each file but in a more human readable way,
85 e.g. appending a size letter for kilobytes (K), megabytes (M),
86 gigabytes (G), terrabytes (T), petabytes (P) and exabytes (E).
87
88 -u Print the username, or UID # if no username is available, of the
89 file.
90
91 -g Print the group name, or GID # if no group name is available, of
92 the file.
93
94 -D Print the date of the last modification time for the file
95 listed.
96
97 --inodes
98 Prints the inode number of the file or directory
99
100 --device
101 Prints the device number to which the file or directory belongs
102
103 -F Append a `/' for directories, a `=' for socket files, a `*' for
104 executable files and a `|' for FIFO's, as per ls -F
105
106 -q Print non-printable characters in filenames as question marks
107 instead of the default caret notation.
108
109 -N Print non-printable characters as is instead of the default
110 caret notation.
111
112 -v Sort the output by version.
113
114 -r Sort the output in reverse alphabetic order.
115
116 -t Sort the output by last modification time instead of alphabeti‐
117 cally.
118
119 --dirsfirst
120 List directories before files.
121
122 -n Turn colorization off always, over-ridden by the -C option.
123
124 -C Turn colorization on always, using built-in color defaults if
125 the LS_COLORS environment variable is not set. Useful to col‐
126 orize output to a pipe.
127
128 -A Turn on ANSI line graphics hack when printing the indentation
129 lines.
130
131 -S Turn on ASCII line graphics (useful when using linux console
132 mode fonts). This option is now equivalent to `--charset=IBM437'
133 and will eventually be depreciated.
134
135 -L level
136 Max display depth of the directory tree.
137
138 --filelimit #
139 Do not descend directories that contain more than # entries.
140
141 -R Recursively cross down the tree each level directories (see -L
142 option), and at each of them execute tree again adding `-o
143 00Tree.html' as a new option.
144
145 -H baseHREF
146 Turn on HTML output, including HTTP references. Useful for ftp
147 sites. baseHREF gives the base ftp location when using HTML
148 output. That is, the local directory may be `/local/ftp/pub',
149 but it must be referenced as `ftp://hostname.organiza‐
150 tion.domain/pub' (baseHREF should be `ftp://hostname.organiza‐
151 tion.domain'). Hint: don't use ANSI lines with this option, and
152 don't give more than one directory in the directory list. If you
153 wish to use colors via CCS stylesheet, use the -C option in
154 addition to this option to force color output.
155
156 -T title
157 Sets the title and H1 header string in HTML output mode.
158
159 --charset charset
160 Set the character set to use when outputting HTML and for line
161 drawing.
162
163 --nolinks
164 Turns off hyperlinks in HTML output.
165
166 -o filename
167 Send output to filename.
168
170 /etc/DIR_COLORS System color database.
171 ~/.dircolors Users color database.
172
173
175 LS_COLORS Color information created by dircolors
176 TREE_CHARSET Character set for tree to use in HTML mode.
177 LC_CTYPE Locale for filename output.
178
179
181 Steve Baker (ice@mama.indstate.edu)
182 HTML output hacked by Francesc Rocher (rocher@econ.udg.es)
183 Charsets and OS/2 support by Kyosuke Tokoro (NBG01720@nifty.ne.jp)
184
185
187 Tree does not prune "empty" directories when the -P and -I options are
188 used. Tree prints directories as it comes to them, so cannot accumu‐
189 late information on files and directories beneath the directory it is
190 printing.
191
192 The -h option rounds to the nearest whole number unlike the ls imple‐
193 mentation of -h which rounds up always. The IEC standard names for
194 powers of 2 cooresponding to metric powers of 10 (KiBi, et al.) are
195 silly.
196
197 Pruning files and directories with the -I, -P and --filelimit options
198 will lead to incorrect file/directory count reports.
199
200 Probably more.
201
202
204 dircolors(1L), ls(1L), find(1L)
205
206
207
208Tree 1.5.3 TREE(1)