remove extraneous .Pp's from SYNOPSIS
[unix-history] / usr / src / usr.sbin / mtree / mtree.8
CommitLineData
b5dc1377 1.\" Copyright (c) 1989, 1990 The Regents of the University of California.
25f14064
KB
2.\" All rights reserved.
3.\"
804e6434 4.\" %sccs.include.redist.roff%
25f14064 5.\"
804e6434 6.\" @(#)mtree.8 5.9 (Berkeley) %G%
25f14064 7.\"
b5dc1377
CL
8.Dd
9.Dt MTREE 8
ee9b0a0a 10.Os
b5dc1377
CL
11.Sh NAME
12.Nm mtree
13.Nd map a directory hierarchy
14.Sh SYNOPSIS
15.Nm mtree
16.Op Fl cderux
17.Op Fl f Ar spec
18.Op Fl p Ar path
19.Sh DESCRIPTION
804e6434
CL
20The utility
21.Nm mtree
f33455dd
KB
22compares a directory hierarchy against a specification for a
23directory hierarchy.
24By default, the specification is read from the standard input.
b5dc1377 25.Nm Mtree
f33455dd
KB
26verifies that the tree rooted in the current directory matches the
27specification.
b5dc1377 28.Pp
f33455dd
KB
29Messages are written to standard output for any files whose
30characteristics do not match those of the specification, or which are
31missing from either the specification or the tree.
b5dc1377 32.Pp
25f14064 33The options are as follows:
804e6434
CL
34.Bl -tag -width Fl c
35.It Fl c
f33455dd 36Print a specification for the tree to standard output.
804e6434 37.It Fl d
f33455dd 38Ignore everything except directory type files.
804e6434 39.It Fl e
f33455dd 40Don't object to files that are in the tree but not in the specification.
804e6434 41.It Fl f
f33455dd 42Read the specification from
b5dc1377 43.Ar file ,
f33455dd 44instead of from standard input.
804e6434 45.It Fl p
f33455dd 46Traverse the tree rooted in
b5dc1377 47.Ar path ,
f33455dd 48instead of the current directory.
804e6434 49.It Fl r
f33455dd 50Remove any files in the tree that are not described in the
25f14064 51specification.
804e6434 52.It Fl u
f33455dd
KB
53Modify the owner, group, and permissions of existing files to match
54the specification, as well as create any missing directories.
55Owner, group, and permissions must all be specified for missing
56directories to be created.
804e6434 57.It Fl x
f33455dd 58Don't descend below any mount points.
804e6434 59.El
b5dc1377 60.Pp
f33455dd
KB
61Specifications are mostly composed of ``keywords'', i.e. strings that
62that specify values relating to files.
25f14064 63No keywords have default values, and if a keyword has no set value no
f33455dd 64checks based on it are performed.
b5dc1377 65.Pp
25f14064 66Currently supported keywords are as follows:
804e6434
CL
67.Bl -tag -width Cm
68.It Cm cksum
25f14064
KB
69The checksum of the file using the algorithm specified by
70the program
b5dc1377 71.Xr cksum 1 .
804e6434 72.It Cm ignore
f33455dd 73Causes the hierarchy below the file to be ignored.
804e6434 74.It Cm group
f33455dd 75The group of the file; may be either numeric or symbolic.
804e6434 76.It Cm mode
f33455dd
KB
77The current file's permissions as an absolute (octal) or symbolic
78value (see
b5dc1377 79.Xr chmod 1 ) .
804e6434 80.It Cm nlink
f33455dd 81The number of hard links the file is expected to have.
804e6434 82.It Cm owner
f33455dd 83The owner of the file; may be either numeric or symbolic.
804e6434 84.It Cm size
f33455dd 85The size, in bytes, of the file.
804e6434 86.It Cm link
25f14064 87The file a symbolic link is expected to reference.
804e6434 88.It Cm time
0af6fb71 89The last modification time of the file.
804e6434 90.It Cm type
f33455dd 91The type of the file; may be set to any one of the following:
804e6434
CL
92.Bl -tag -width Cm
93.It Cm block
f33455dd 94block special device
804e6434 95.It Cm char
f33455dd 96character special device
804e6434 97.It Cm dir
f33455dd 98directory
804e6434 99.It Cm fifo
f33455dd 100fifo
804e6434 101.It Cm file
f33455dd 102regular file
804e6434 103.It Cm link
f33455dd 104symbolic link
804e6434 105.It Cm socket
f33455dd 106socket
804e6434
CL
107.El
108.El
b5dc1377 109.Pp
f33455dd 110There are four types of lines in a specification.
b5dc1377 111.Pp
f33455dd
KB
112The first type of line sets a ``global'' value for a keyword, and
113consists of a leading ``/set'' followed by whitespace, followed by
114sets of keyword/value pairs, separated by whitespace.
115Keyword/value pairs consist of a keyword, followed by a equals sign
116(``=''), followed by a value, without intervening whitespace.
117Once a keyword has been set, its value remains unchanged until either
118set again or unset.
b5dc1377 119.Pp
f33455dd
KB
120The second type of line unsets keywords and consists of a leading
121``/unset'', followed by whitespace, followed by one or more keywords,
122separated by whitespace.
b5dc1377 123.Pp
f33455dd
KB
124The third type of line is a file specification and consists of a file
125name, followed by whitespace, followed by zero or more whitespace
126separated keyword/value pairs.
127The file name may be preceded by any number of whitespace characters.
128The file name may contain any of the standard file name matching
129characters (``['', ``]'', ``?'' or ``*''), in which case files
130in the hierarchy will be associated with the first pattern that
131they match.
b5dc1377 132.Pp
f33455dd
KB
133Each of the keyword/value pairs consist of a keyword, followed by an
134equals sign (``=''), followed by the keyword's value, without intervening
135whitespace.
136These values override, without changing, the global value of the
25f14064 137corresponding keyword.
b5dc1377 138.Pp
25f14064 139All paths are relative.
f33455dd
KB
140Specifying a directory will cause subsequent files to be searched
141for in that directory hierarchy.
25f14064 142Which brings us to the last type of line in a specification: a line
b5dc1377
CL
143containing only the string
144.Dq Nm \&..
145causes the current directory
f33455dd 146path to ascend one level.
b5dc1377 147.Pp
f33455dd
KB
148Empty lines and lines whose first non-whitespace character is a hash
149mark (``#'') are ignored.
b5dc1377
CL
150.Pp
151.Nm Mtree
f33455dd
KB
152exits with a status of 0 on success and >0 if an error occurred or the
153tree did not match the specification.
b5dc1377 154.Sh FILES
804e6434
CL
155.Bl -tag -width /etc/mtree -compact
156.It Pa /etc/mtree
b5dc1377 157system specification directory
804e6434 158.El
b5dc1377
CL
159.Sh SEE ALSO
160.Xr chmod 1 ,
161.Xr chown 1 ,
162.Xr chgrp 1 ,
163.Xr cksum 1 ,
164.Xr find 1 ,
165.Xr stat 2 ,
166.Xr fts 3 ,
167.Xr mkproto 8
168.Sh BUGS
f33455dd 169The
b5dc1377 170.Cm cksum
f33455dd 171keyword is not yet implemented.
b5dc1377 172.Pp
0af6fb71 173The
b5dc1377 174.Cm time
0af6fb71 175keyword should be specifiable in human readable terms.
b5dc1377 176.Sh EXAMPLE
804e6434 177.Bd -literal -offset indent -compact
f33455dd
KB
178# fs: /a/staff/rick/mybin
179# by: rick
180# date: Fri May 25 12:26:57 1990
804e6434 181
f33455dd 182/set group=staff mode=0555 nlink=1 owner=rick type=file
b5dc1377 183[ nlink=2 size=6144
f33455dd
KB
184adb size=53248
185df group=operator mode=02555 size=20480
186ps group=kmem mode=02555 size=54272
187rcp owner=root mode=04555 size=79872
188test nlink=2 size=6144
804e6434 189
f33455dd
KB
190/set group=wheel mode=0444 nlink=1 owner=rick type=file
191manpages type=dir mode=0775 nlink=2 size=1024
b5dc1377
CL
192adb.man size=9473
193df.man size=5263
194tar.man size=3324
f33455dd 195\&..
804e6434 196.Ed
b5dc1377 197.Sh HISTORY
804e6434
CL
198The
199.Nm mtree
200utility appeared in
201.Bx 4.3 Reno .