1TREE(1) General Commands Manual TREE(1)
2
3
4
6 tree - list contents of directories in a tree-like format.
7
9 tree [-adfgilnopqrstuxACDFNS] [-L level [-R]] [-H baseHREF] [-T title]
10 [-o filename] [--nolinks] [-P pattern] [-I pattern] [--inodes]
11 [--device] [--noreport] [--dirsfirst] [--version] [--help] [directory
12 ...]
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 protections for each file (as per ls -l).
80
81 -s Print the size of each file along with the name.
82
83 -u Print the username, or UID # if no username is available, of the
84 file.
85
86 -g Print the group name, or GID # if no group name is available, of
87 the file.
88
89 -D Print the date of the last modification time for the file
90 listed.
91
92 --inodes
93 Prints the inode number of the file or directory
94
95 --device
96 Prints the device number to which the file or directory belongs
97
98 -F Append a `/' for directories, a `=' for socket files, a `*' for
99 executable files and a `|' for FIFO's, as per ls -F
100
101 -q Print non-printable characters in filenames as question marks
102 instead of the default caret notation.
103
104 -N Print non-printable characters as is instead of the default
105 caret notation.
106
107 -r Sort the output in reverse alphabetic order.
108
109 -t Sort the output by last modification time instead of alphabeti‐
110 cally.
111
112 --dirsfirst
113 List directories before files.
114
115 -n Turn colorization off always, over-ridden by the -C option.
116
117 -C Turn colorization on always, using built-in color defaults if
118 the LS_COLORS environment variable is not set. Useful to col‐
119 orize output to a pipe.
120
121 -A Turn on ANSI line graphics hack when printing the indentation
122 lines.
123
124 -S Turn on ASCII line graphics (useful when using linux console
125 mode fonts). This option is now equivalent to `--charset=IBM437'
126 and will eventually be depreciated.
127
128 -L level
129 Max display depth of the directory tree.
130
131 -R Recursively cross down the tree each level directories (see -L
132 option), and at each of them execute tree again adding `-o
133 00Tree.html' as a new option.
134
135 -H baseHREF
136 Turn on HTML output, including HTTP references. Useful for ftp
137 sites. baseHREF gives the base ftp location when using HTML
138 output. That is, the local directory may be `/local/ftp/pub',
139 but it must be referenced as `ftp://hostname.organiza‐
140 tion.domain/pub' (baseHREF should be `ftp://hostname.organiza‐
141 tion.domain'). Hint: don't use ANSI lines with this option, and
142 don't give more than one directory in the directory list. If you
143 wish to use colors via CCS stylesheet, use the -C option in
144 addition to this option to force color output.
145
146 -T title
147 Sets the title and H1 header string in HTML output mode.
148
149 --charset charset
150 Set the character set to use when outputting HTML and for line
151 drawing.
152
153 --nolinks
154 Turns off hyperlinks in HTML output.
155
156 -o filename
157 Send output to filename.
158
160 /etc/DIR_COLORS System color database.
161 ~/.dircolors Users color database.
162
163
165 LS_COLORS Color information created by dircolors
166 TREE_CHARSET Character set for tree to use in HTML mode.
167 LC_CTYPE Locale for filename output.
168
169
171 Steve Baker (ice@mama.indstate.edu)
172 HTML output hacked by Francesc Rocher (rocher@econ.udg.es)
173 Charsets and OS/2 support by Kyosuke Tokoro (NBG01720@nifty.ne.jp)
174
175
177 Tree does not prune "empty" directories when the -P and -I options are
178 used. Tree prints directories as it comes to them, so cannot accumu‐
179 late information on files and directories beneath the directory it is
180 printing. Probably more.
181
182
184 dircolors(1L), ls(1L), find(1L)
185
186
187
188Tree 1.5.0 TREE(1)