xref: /openbsd/bin/pax/pax.1 (revision c1aa369b)
1*c1aa369bSjmc.\"	$OpenBSD: pax.1,v 1.44 2004/02/19 19:15:32 jmc Exp $
2df930be7Sderaadt.\"	$NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
3df930be7Sderaadt.\"
4df930be7Sderaadt.\" Copyright (c) 1992 Keith Muller.
5df930be7Sderaadt.\" Copyright (c) 1992, 1993
6df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
7df930be7Sderaadt.\"
8df930be7Sderaadt.\" This code is derived from software contributed to Berkeley by
9df930be7Sderaadt.\" Keith Muller of the University of California, San Diego.
10df930be7Sderaadt.\"
11df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
12df930be7Sderaadt.\" modification, are permitted provided that the following conditions
13df930be7Sderaadt.\" are met:
14df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
15df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
16df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
17df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
18df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
1929295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
20df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
21df930be7Sderaadt.\"    without specific prior written permission.
22df930be7Sderaadt.\"
23df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33df930be7Sderaadt.\" SUCH DAMAGE.
34df930be7Sderaadt.\"
35df930be7Sderaadt.\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
36df930be7Sderaadt.\"
37df930be7Sderaadt.Dd April 18, 1994
38df930be7Sderaadt.Dt PAX 1
39fc8533a3Saaron.Os
40df930be7Sderaadt.Sh NAME
41df930be7Sderaadt.Nm pax
42df930be7Sderaadt.Nd read and write file archives and copy directory hierarchies
43df930be7Sderaadt.Sh SYNOPSIS
44189213daSderaadt.Nm pax
459cd57097Smillert.Op Fl 0cdnvz
46df930be7Sderaadt.Bk -words
47df930be7Sderaadt.Op Fl f Ar archive
48df930be7Sderaadt.Ek
49df930be7Sderaadt.Bk -words
50df930be7Sderaadt.Op Fl s Ar replstr
51df930be7Sderaadt.Ar ...
52df930be7Sderaadt.Ek
53df930be7Sderaadt.Bk -words
54df930be7Sderaadt.Op Fl U Ar user
55df930be7Sderaadt.Ar ...
56df930be7Sderaadt.Ek
57df930be7Sderaadt.Bk -words
58df930be7Sderaadt.Op Fl G Ar group
59df930be7Sderaadt.Ar ...
60df930be7Sderaadt.Ek
61df930be7Sderaadt.Bk -words
62df930be7Sderaadt.Oo
63df930be7Sderaadt.Fl T
64df930be7Sderaadt.Op Ar from_date
65df930be7Sderaadt.Op Ar ,to_date
66df930be7Sderaadt.Oc
67df930be7Sderaadt.Ar ...
68df930be7Sderaadt.Ek
69df930be7Sderaadt.Op Ar pattern ...
70189213daSderaadt.Nm pax
71df930be7Sderaadt.Fl r
7207ba6642Sderaadt.Op Fl cdiknuvzDYZ
73df930be7Sderaadt.Bk -words
74df930be7Sderaadt.Op Fl f Ar archive
75df930be7Sderaadt.Ek
76df930be7Sderaadt.Bk -words
77df930be7Sderaadt.Op Fl o Ar options
78df930be7Sderaadt.Ar ...
79df930be7Sderaadt.Ek
80df930be7Sderaadt.Bk -words
81df930be7Sderaadt.Op Fl p Ar string
82df930be7Sderaadt.Ar ...
83df930be7Sderaadt.Ek
84df930be7Sderaadt.Bk -words
85df930be7Sderaadt.Op Fl s Ar replstr
86df930be7Sderaadt.Ar ...
87df930be7Sderaadt.Ek
88df930be7Sderaadt.Op Fl E Ar limit
89df930be7Sderaadt.Bk -words
90df930be7Sderaadt.Op Fl U Ar user
91df930be7Sderaadt.Ar ...
92df930be7Sderaadt.Ek
93df930be7Sderaadt.Bk -words
94df930be7Sderaadt.Op Fl G Ar group
95df930be7Sderaadt.Ar ...
96df930be7Sderaadt.Ek
97df930be7Sderaadt.Bk -words
98df930be7Sderaadt.Oo
99df930be7Sderaadt.Fl T
100df930be7Sderaadt.Op Ar from_date
101df930be7Sderaadt.Op Ar ,to_date
102df930be7Sderaadt.Oc
103df930be7Sderaadt.Ar ...
104df930be7Sderaadt.Ek
105df930be7Sderaadt.Op Ar pattern ...
106189213daSderaadt.Nm pax
107df930be7Sderaadt.Fl w
1089cd57097Smillert.Op Fl 0dituvzHLPX
109df930be7Sderaadt.Bk -words
110df930be7Sderaadt.Op Fl b Ar blocksize
111df930be7Sderaadt.Ek
112df930be7Sderaadt.Oo
113df930be7Sderaadt.Op Fl a
114df930be7Sderaadt.Op Fl f Ar archive
115df930be7Sderaadt.Oc
116df930be7Sderaadt.Bk -words
117df930be7Sderaadt.Op Fl x Ar format
118df930be7Sderaadt.Ek
119df930be7Sderaadt.Bk -words
120df930be7Sderaadt.Op Fl s Ar replstr
121df930be7Sderaadt.Ar ...
122df930be7Sderaadt.Ek
123df930be7Sderaadt.Bk -words
124df930be7Sderaadt.Op Fl o Ar options
125df930be7Sderaadt.Ar ...
126df930be7Sderaadt.Ek
127df930be7Sderaadt.Bk -words
128df930be7Sderaadt.Op Fl U Ar user
129df930be7Sderaadt.Ar ...
130df930be7Sderaadt.Ek
131df930be7Sderaadt.Bk -words
132df930be7Sderaadt.Op Fl G Ar group
133df930be7Sderaadt.Ar ...
134df930be7Sderaadt.Ek
135df930be7Sderaadt.Bk -words
136df930be7Sderaadt.Op Fl B Ar bytes
137df930be7Sderaadt.Ek
138df930be7Sderaadt.Bk -words
139df930be7Sderaadt.Oo
140df930be7Sderaadt.Fl T
141df930be7Sderaadt.Op Ar from_date
142df930be7Sderaadt.Op Ar ,to_date
143df930be7Sderaadt.Op Ar /[c][m]
144df930be7Sderaadt.Oc
145df930be7Sderaadt.Ar ...
146df930be7Sderaadt.Ek
147df930be7Sderaadt.Op Ar file ...
148189213daSderaadt.Nm pax
149df930be7Sderaadt.Fl r
150df930be7Sderaadt.Fl w
1519cd57097Smillert.Op Fl 0diklntuvDHLPXYZ
152df930be7Sderaadt.Bk -words
153df930be7Sderaadt.Op Fl p Ar string
154df930be7Sderaadt.Ar ...
155df930be7Sderaadt.Ek
156df930be7Sderaadt.Bk -words
157df930be7Sderaadt.Op Fl s Ar replstr
158df930be7Sderaadt.Ar ...
159df930be7Sderaadt.Ek
160df930be7Sderaadt.Bk -words
161df930be7Sderaadt.Op Fl U Ar user
162df930be7Sderaadt.Ar ...
163df930be7Sderaadt.Ek
164df930be7Sderaadt.Bk -words
165df930be7Sderaadt.Op Fl G Ar group
166df930be7Sderaadt.Ar ...
167df930be7Sderaadt.Ek
168df930be7Sderaadt.Bk -words
169df930be7Sderaadt.Oo
170df930be7Sderaadt.Fl T
171df930be7Sderaadt.Op Ar from_date
172df930be7Sderaadt.Op Ar ,to_date
173df930be7Sderaadt.Op Ar /[c][m]
174df930be7Sderaadt.Oc
175df930be7Sderaadt.Ar ...
176df930be7Sderaadt.Ek
177df930be7Sderaadt.Op Ar file ...
178df930be7Sderaadt.Ar directory
179df930be7Sderaadt.Sh DESCRIPTION
180f11c8a18Saaron.Nm
181df930be7Sderaadtwill read, write, and list the members of an archive file,
182df930be7Sderaadtand will copy directory hierarchies.
183f11c8a18Saaron.Nm
184df930be7Sderaadtoperation is independent of the specific archive format,
185df930be7Sderaadtand supports a wide variety of different archive formats.
186df930be7SderaadtA list of supported archive formats can be found under the description of the
187df930be7Sderaadt.Fl x
188df930be7Sderaadtoption.
189df930be7Sderaadt.Pp
190df930be7SderaadtThe presence of the
191df930be7Sderaadt.Fl r
192df930be7Sderaadtand the
193df930be7Sderaadt.Fl w
194df930be7Sderaadtoptions specifies which of the following functional modes
195f11c8a18Saaron.Nm
196df930be7Sderaadtwill operate under:
197df930be7Sderaadt.Em list , read , write ,
198df930be7Sderaadtand
199df930be7Sderaadt.Em copy .
200df930be7Sderaadt.Bl -tag -width 6n
201df930be7Sderaadt.It <none>
202df930be7Sderaadt.Em List .
203f11c8a18Saaron.Nm
204cdba0873Saaronwill write to standard output
205df930be7Sderaadta table of contents of the members of the archive file read from
206cdba0873Saaronstandard input, whose pathnames match the specified
207df930be7Sderaadt.Ar patterns .
208df930be7SderaadtThe table of contents contains one filename per line
209df930be7Sderaadtand is written using single line buffering.
210df930be7Sderaadt.It Fl r
211df930be7Sderaadt.Em Read .
212f11c8a18Saaron.Nm
213cdba0873Saaronextracts the members of the archive file read from the standard input,
214df930be7Sderaadtwith pathnames matching the specified
215df930be7Sderaadt.Ar patterns .
216df930be7SderaadtThe archive format and blocking is automatically determined on input.
217df930be7SderaadtWhen an extracted file is a directory, the entire file hierarchy
218df930be7Sderaadtrooted at that directory is extracted.
219df930be7SderaadtAll extracted files are created relative to the current file hierarchy.
220df930be7SderaadtThe setting of ownership, access and modification times, and file mode of
221df930be7Sderaadtthe extracted files are discussed in more detail under the
222df930be7Sderaadt.Fl p
223df930be7Sderaadtoption.
224df930be7Sderaadt.It Fl w
225df930be7Sderaadt.Em Write .
226f11c8a18Saaron.Nm
227df930be7Sderaadtwrites an archive containing the
228df930be7Sderaadt.Ar file
229cdba0873Saaronoperands to standard output
230df930be7Sderaadtusing the specified archive format.
231df930be7SderaadtWhen no
232df930be7Sderaadt.Ar file
233df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from
234cdba0873Saaronstandard input.
235df930be7SderaadtWhen a
236df930be7Sderaadt.Ar file
237df930be7Sderaadtoperand is also a directory, the entire file hierarchy rooted
238df930be7Sderaadtat that directory will be included.
239df930be7Sderaadt.It Fl r Fl w
240df930be7Sderaadt.Em Copy .
241f11c8a18Saaron.Nm
242df930be7Sderaadtcopies the
243df930be7Sderaadt.Ar file
244df930be7Sderaadtoperands to the destination
245df930be7Sderaadt.Ar directory .
246df930be7SderaadtWhen no
247df930be7Sderaadt.Ar file
248df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from
249cdba0873Saaronthe standard input.
250df930be7SderaadtWhen a
251df930be7Sderaadt.Ar file
252df930be7Sderaadtoperand is also a directory the entire file
253df930be7Sderaadthierarchy rooted at that directory will be included.
254df930be7SderaadtThe effect of the
255df930be7Sderaadt.Em copy
256df930be7Sderaadtis as if the copied files were written to an archive file and then
257df930be7Sderaadtsubsequently extracted, except that there may be hard links between
258df930be7Sderaadtthe original and the copied files (see the
259df930be7Sderaadt.Fl l
260df930be7Sderaadtoption below).
261df930be7Sderaadt.Pp
262df930be7Sderaadt.Em Warning :
263df930be7SderaadtThe destination
264df930be7Sderaadt.Ar directory
265df930be7Sderaadtmust not be one of the
266df930be7Sderaadt.Ar file
267df930be7Sderaadtoperands or a member of a file hierarchy rooted at one of the
268df930be7Sderaadt.Ar file
269df930be7Sderaadtoperands.
270df930be7SderaadtThe result of a
271df930be7Sderaadt.Em copy
272df930be7Sderaadtunder these conditions is unpredictable.
273df930be7Sderaadt.El
274df930be7Sderaadt.Pp
275df930be7SderaadtWhile processing a damaged archive during a
276df930be7Sderaadt.Em read
277df930be7Sderaadtor
278df930be7Sderaadt.Em list
279df930be7Sderaadtoperation,
280f11c8a18Saaron.Nm
281df930be7Sderaadtwill attempt to recover from media defects and will search through the archive
282df930be7Sderaadtto locate and process the largest number of archive members possible (see the
283df930be7Sderaadt.Fl E
284df930be7Sderaadtoption for more details on error handling).
28538a123d1Saaron.Pp
286df930be7SderaadtThe
287df930be7Sderaadt.Ar directory
288df930be7Sderaadtoperand specifies a destination directory pathname.
289df930be7SderaadtIf the
290df930be7Sderaadt.Ar directory
291df930be7Sderaadtoperand does not exist, or it is not writable by the user,
292df930be7Sderaadtor it is not of type directory,
293f11c8a18Saaron.Nm
294df930be7Sderaadtwill exit with a non-zero exit status.
295df930be7Sderaadt.Pp
296df930be7SderaadtThe
297df930be7Sderaadt.Ar pattern
298df930be7Sderaadtoperand is used to select one or more pathnames of archive members.
299df930be7SderaadtArchive members are selected using the pattern matching notation described
300df930be7Sderaadtby
301df930be7Sderaadt.Xr fnmatch 3 .
302df930be7SderaadtWhen the
303df930be7Sderaadt.Ar pattern
304df930be7Sderaadtoperand is not supplied, all members of the archive will be selected.
305df930be7SderaadtWhen a
306df930be7Sderaadt.Ar pattern
307df930be7Sderaadtmatches a directory, the entire file hierarchy rooted at that directory will
308df930be7Sderaadtbe selected.
309df930be7SderaadtWhen a
310df930be7Sderaadt.Ar pattern
311df930be7Sderaadtoperand does not select at least one archive member,
312f11c8a18Saaron.Nm
313df930be7Sderaadtwill write these
314df930be7Sderaadt.Ar pattern
3156339491eSjmcoperands in a diagnostic message to standard error
316df930be7Sderaadtand then exit with a non-zero exit status.
317df930be7Sderaadt.Pp
318df930be7SderaadtThe
319df930be7Sderaadt.Ar file
320df930be7Sderaadtoperand specifies the pathname of a file to be copied or archived.
321df930be7SderaadtWhen a
322df930be7Sderaadt.Ar file
323df930be7Sderaadtoperand does not select at least one archive member,
324f11c8a18Saaron.Nm
325df930be7Sderaadtwill write these
326df930be7Sderaadt.Ar file
327cdba0873Saaronoperand pathnames in a diagnostic message to standard error
328df930be7Sderaadtand then exit with a non-zero exit status.
32938a123d1Saaron.Pp
3308cf461a5SaaronThe options are as follows:
331f1ba3473Saaron.Bl -tag -width Ds
332df930be7Sderaadt.It Fl r
333cdba0873SaaronRead an archive file from standard input
334df930be7Sderaadtand extract the specified
335df930be7Sderaadt.Ar files .
336df930be7SderaadtIf any intermediate directories are needed in order to extract an archive
337df930be7Sderaadtmember, these directories will be created as if
338df930be7Sderaadt.Xr mkdir 2
339df930be7Sderaadtwas called with the bitwise inclusive
340cdba0873Saaron.Tn OR
341df930be7Sderaadtof
342df930be7Sderaadt.Dv S_IRWXU , S_IRWXG ,
343df930be7Sderaadtand
344df930be7Sderaadt.Dv S_IRWXO
345df930be7Sderaadtas the mode argument.
346df930be7SderaadtWhen the selected archive format supports the specification of linked
347df930be7Sderaadtfiles and these files cannot be linked while the archive is being extracted,
348f11c8a18Saaron.Nm
349cdba0873Saaronwill write a diagnostic message to standard error
350df930be7Sderaadtand exit with a non-zero exit status at the completion of operation.
351df930be7Sderaadt.It Fl w
35241e359e0SaaronWrite files to the standard output
353df930be7Sderaadtin the specified archive format.
354df930be7SderaadtWhen no
355df930be7Sderaadt.Ar file
356cdba0873Saaronoperands are specified, standard input
357df930be7Sderaadtis read for a list of pathnames with one per line without any leading or
358df930be7Sderaadttrailing
359df930be7Sderaadt.Aq blanks .
360df930be7Sderaadt.It Fl a
361df930be7SderaadtAppend
362df930be7Sderaadt.Ar files
363df930be7Sderaadtto the end of an archive that was previously written.
364df930be7SderaadtIf an archive format is not specified with a
365df930be7Sderaadt.Fl x
366df930be7Sderaadtoption, the format currently being used in the archive will be selected.
367df930be7SderaadtAny attempt to append to an archive in a format different from the
368df930be7Sderaadtformat already used in the archive will cause
369f11c8a18Saaron.Nm
370df930be7Sderaadtto exit immediately
371df930be7Sderaadtwith a non-zero exit status.
372df930be7SderaadtThe blocking size used in the archive volume where writing starts
373df930be7Sderaadtwill continue to be used for the remainder of that archive volume.
374df930be7Sderaadt.Pp
375df930be7Sderaadt.Em Warning :
376df930be7SderaadtMany storage devices are not able to support the operations necessary
377df930be7Sderaadtto perform an append operation.
378df930be7SderaadtAny attempt to append to an archive stored on such a device may damage the
379df930be7Sderaadtarchive or have other unpredictable results.
380df930be7SderaadtTape drives in particular are more likely to not support an append operation.
381df930be7SderaadtAn archive stored in a regular file system file or on a disk device will
382df930be7Sderaadtusually support an append operation.
3839cd57097Smillert.It Fl 0
3849cd57097SmillertUse the NUL
3859cd57097Smillert.Pq Ql \e0
3869cd57097Smillertcharacter as a pathname terminator, instead of newline
3879cd57097Smillert.Pq Ql \en .
3889cd57097SmillertThis applies only to the pathnames read from standard input in
3899cd57097Smillertthe write and copy modes,
3909cd57097Smillertand to the pathnames written to standard output in list mode.
3919cd57097SmillertThis option is expected to be used in concert with the
3929cd57097Smillert.Fl print0
3939cd57097Smillertfunction in
3949cd57097Smillert.Xr find 1
3959cd57097Smillertor the
3969cd57097Smillert.Fl 0
3979cd57097Smillertflag in
3989cd57097Smillert.Xr xargs 1 .
399df930be7Sderaadt.It Fl b Ar blocksize
400df930be7SderaadtWhen
401df930be7Sderaadt.Em writing
402df930be7Sderaadtan archive,
403df930be7Sderaadtblock the output at a positive decimal integer number of
404df930be7Sderaadtbytes per write to the archive file.
405df930be7SderaadtThe
406df930be7Sderaadt.Ar blocksize
407ea4b1a1aSmillertmust be a multiple of 512 bytes with a maximum of 64512 bytes.
408ea4b1a1aSmillertArchives larger than 32256 bytes violate the
409ea4b1a1aSmillert.Tn POSIX
410ea4b1a1aSmillertstandard and will not be portable to all systems.
411df930be7SderaadtA
412df930be7Sderaadt.Ar blocksize
413df930be7Sderaadtcan end with
414f81d96dfSaaron.Sq Li k
415df930be7Sderaadtor
416f81d96dfSaaron.Sq Li b
417df930be7Sderaadtto specify multiplication by 1024 (1K) or 512, respectively.
418df930be7SderaadtA pair of
419df930be7Sderaadt.Ar blocksizes
420df930be7Sderaadtcan be separated by
421f81d96dfSaaron.Sq Li x
422df930be7Sderaadtto indicate a product.
423df930be7SderaadtA specific archive device may impose additional restrictions on the size
424df930be7Sderaadtof blocking it will support.
425df930be7SderaadtWhen blocking is not specified, the default
426df930be7Sderaadt.Ar blocksize
427df930be7Sderaadtis dependent on the specific archive format being used (see the
428df930be7Sderaadt.Fl x
429df930be7Sderaadtoption).
430df930be7Sderaadt.It Fl c
431df930be7SderaadtMatch all file or archive members
432df930be7Sderaadt.Em except
433df930be7Sderaadtthose specified by the
434df930be7Sderaadt.Ar pattern
435df930be7Sderaadtand
436df930be7Sderaadt.Ar file
437df930be7Sderaadtoperands.
438df930be7Sderaadt.It Fl d
439df930be7SderaadtCause files of type directory being copied or archived, or archive members of
440df930be7Sderaadttype directory being extracted, to match only the directory file or archive
441df930be7Sderaadtmember and not the file hierarchy rooted at the directory.
442df930be7Sderaadt.It Fl f Ar archive
443df930be7SderaadtSpecify
444df930be7Sderaadt.Ar archive
445df930be7Sderaadtas the pathname of the input or output archive, overriding the default
446cdba0873Saaronstandard input (for
447df930be7Sderaadt.Em list
448df930be7Sderaadtand
449df930be7Sderaadt.Em read )
450cdba0873Saaronor standard output
451df930be7Sderaadt(for
452df930be7Sderaadt.Em write ) .
453df930be7SderaadtA single archive may span multiple files and different archive devices.
454df930be7SderaadtWhen required,
455f11c8a18Saaron.Nm
456df930be7Sderaadtwill prompt for the pathname of the file or device of the next volume in the
457df930be7Sderaadtarchive.
458df930be7Sderaadt.It Fl i
459df930be7SderaadtInteractively rename files or archive members.
460df930be7SderaadtFor each archive member matching a
461df930be7Sderaadt.Ar pattern
462df930be7Sderaadtoperand or each file matching a
463df930be7Sderaadt.Ar file
464df930be7Sderaadtoperand,
465f11c8a18Saaron.Nm
466df930be7Sderaadtwill prompt to
467df930be7Sderaadt.Pa /dev/tty
4681fd45b44Saarongiving the name of the file, its file mode, and its modification time.
469f11c8a18Saaron.Nm
470df930be7Sderaadtwill then read a line from
471df930be7Sderaadt.Pa /dev/tty .
472df930be7SderaadtIf this line is blank, the file or archive member is skipped.
473df930be7SderaadtIf this line consists of a single period, the
474df930be7Sderaadtfile or archive member is processed with no modification to its name.
475df930be7SderaadtOtherwise, its name is replaced with the contents of the line.
476f11c8a18Saaron.Nm
477df930be7Sderaadtwill immediately exit with a non-zero exit status if
478cdba0873Saaron.Dv EOF
479df930be7Sderaadtis encountered when reading a response or if
480df930be7Sderaadt.Pa /dev/tty
481df930be7Sderaadtcannot be opened for reading and writing.
482df930be7Sderaadt.It Fl k
483df930be7SderaadtDo not overwrite existing files.
484df930be7Sderaadt.It Fl l
485b3119326Saaron(The lowercase letter
4860cd08285Sjmc.Dq ell. )
487b3119326SaaronLink files.
488df930be7SderaadtIn the
489df930be7Sderaadt.Em copy
490f81d96dfSaaronmode
491f81d96dfSaaron.Pq Fl r Fl w ,
492df930be7Sderaadthard links are made between the source and destination file hierarchies
493df930be7Sderaadtwhenever possible.
494df930be7Sderaadt.It Fl n
495df930be7SderaadtSelect the first archive member that matches each
496df930be7Sderaadt.Ar pattern
497df930be7Sderaadtoperand.
498df930be7SderaadtNo more than one archive member is matched for each
499df930be7Sderaadt.Ar pattern .
500df930be7SderaadtWhen members of type directory are matched, the file hierarchy rooted at that
501df930be7Sderaadtdirectory is also matched (unless
502df930be7Sderaadt.Fl d
503df930be7Sderaadtis also specified).
504df930be7Sderaadt.It Fl o Ar options
505df930be7SderaadtInformation to modify the algorithm for extracting or writing archive files
506df930be7Sderaadtwhich is specific to the archive format specified by
507df930be7Sderaadt.Fl x .
508df930be7SderaadtIn general,
509df930be7Sderaadt.Ar options
510df930be7Sderaadttake the form:
511d741230eSjmc.Ar name Ns = Ns Ar value .
512df930be7Sderaadt.It Fl p Ar string
513df930be7SderaadtSpecify one or more file characteristic options (privileges).
514df930be7SderaadtThe
515df930be7Sderaadt.Ar string
516df930be7Sderaadtoption-argument is a string specifying file characteristics to be retained or
517df930be7Sderaadtdiscarded on extraction.
518df930be7SderaadtThe string consists of the specification characters
519df930be7Sderaadt.Cm a , e , m , o ,
520df930be7Sderaadtand
521df930be7Sderaadt.Cm p .
522df930be7SderaadtMultiple characteristics can be concatenated within the same string
523df930be7Sderaadtand multiple
524df930be7Sderaadt.Fl p
525df930be7Sderaadtoptions can be specified.
526ff488c0dSjmcThe meanings of the specification characters are as follows:
527df930be7Sderaadt.Bl -tag -width 2n
528df930be7Sderaadt.It Cm a
529df930be7SderaadtDo not preserve file access times.
530df930be7SderaadtBy default, file access times are preserved whenever possible.
531df930be7Sderaadt.It Cm e
532df930be7Sderaadt.Sq Preserve everything ,
533df930be7Sderaadtthe user ID, group ID, file mode bits,
534df930be7Sderaadtfile access time, and file modification time.
535df930be7SderaadtThis is intended to be used by
536df930be7Sderaadt.Em root ,
537df930be7Sderaadtsomeone with all the appropriate privileges, in order to preserve all
538df930be7Sderaadtaspects of the files as they are recorded in the archive.
539df930be7SderaadtThe
540df930be7Sderaadt.Cm e
541df930be7Sderaadtflag is the sum of the
542df930be7Sderaadt.Cm o
543df930be7Sderaadtand
544df930be7Sderaadt.Cm p
545df930be7Sderaadtflags.
546df930be7Sderaadt.It Cm m
547df930be7SderaadtDo not preserve file modification times.
548df930be7SderaadtBy default, file modification times are preserved whenever possible.
549df930be7Sderaadt.It Cm o
550df930be7SderaadtPreserve the user ID and group ID.
551df930be7Sderaadt.It Cm p
552df930be7Sderaadt.Sq Preserve
553df930be7Sderaadtthe file mode bits.
5546339491eSjmcThis is intended to be used by a
555df930be7Sderaadt.Em user
556df930be7Sderaadtwith regular privileges who wants to preserve all aspects of the file other
557df930be7Sderaadtthan the ownership.
558df930be7SderaadtThe file times are preserved by default, but two other flags are offered to
559df930be7Sderaadtdisable this and use the time of extraction instead.
560df930be7Sderaadt.El
561df930be7Sderaadt.Pp
562df930be7SderaadtIn the preceding list,
563df930be7Sderaadt.Sq preserve
564df930be7Sderaadtindicates that an attribute stored in the archive is given to the
565df930be7Sderaadtextracted file, subject to the permissions of the invoking
566df930be7Sderaadtprocess.
567df930be7SderaadtOtherwise the attribute of the extracted file is determined as
568df930be7Sderaadtpart of the normal file creation action.
569df930be7SderaadtIf neither the
570df930be7Sderaadt.Cm e
571df930be7Sderaadtnor the
572df930be7Sderaadt.Cm o
573df930be7Sderaadtspecification character is specified, or the user ID and group ID are not
574df930be7Sderaadtpreserved for any reason,
575f11c8a18Saaron.Nm
576df930be7Sderaadtwill not set the
577df930be7Sderaadt.Dv S_ISUID
578df930be7Sderaadt.Em ( setuid )
579df930be7Sderaadtand
580df930be7Sderaadt.Dv S_ISGID
581df930be7Sderaadt.Em ( setgid )
582df930be7Sderaadtbits of the file mode.
583df930be7SderaadtIf the preservation of any of these items fails for any reason,
584f11c8a18Saaron.Nm
585cdba0873Saaronwill write a diagnostic message to standard error.
586df930be7SderaadtFailure to preserve these items will affect the final exit status,
587df930be7Sderaadtbut will not cause the extracted file to be deleted.
588df930be7SderaadtIf the file characteristic letters in any of the string option-arguments are
589df930be7Sderaadtduplicated or conflict with each other, the one(s) given last will take
590df930be7Sderaadtprecedence.
591df930be7SderaadtFor example, if
592df930be7Sderaadt.Dl Fl p Ar eme
593df930be7Sderaadtis specified, file modification times are still preserved.
594df930be7Sderaadt.It Fl s Ar replstr
595df930be7SderaadtModify the file or archive member names specified by the
596df930be7Sderaadt.Ar pattern
597df930be7Sderaadtor
598df930be7Sderaadt.Ar file
599df930be7Sderaadtoperands according to the substitution expression
600df930be7Sderaadt.Ar replstr ,
601df930be7Sderaadtusing the syntax of the
602df930be7Sderaadt.Xr ed 1
603df930be7Sderaadtutility regular expressions.
604ff488c0dSjmcThe format of these regular expressions is:
605df930be7Sderaadt.Dl /old/new/[gp]
606df930be7SderaadtAs in
607df930be7Sderaadt.Xr ed 1 ,
608df930be7Sderaadt.Cm old
609df930be7Sderaadtis a basic regular expression and
610df930be7Sderaadt.Cm new
611cdba0873Saaroncan contain an ampersand
612cdba0873Saaron.Pq Ql & ,
613cdba0873Saaron.Ql \en
614cdba0873Saaron(where
615cdba0873Saaron.Ar n
616cdba0873Saaronis a digit) back-references,
617df930be7Sderaadtor subexpression matching.
618df930be7SderaadtThe
619df930be7Sderaadt.Cm old
620cdba0873Saaronstring may also contain newline characters.
621cdba0873SaaronAny non-null character can be used as a delimiter
622cdba0873Saaron.Po
623cdba0873Saaron.Ql /
624cdba0873Saaronis shown here
625cdba0873Saaron.Pc .
626df930be7SderaadtMultiple
627df930be7Sderaadt.Fl s
628df930be7Sderaadtexpressions can be specified.
629df930be7SderaadtThe expressions are applied in the order they are specified on the
630df930be7Sderaadtcommand line, terminating with the first successful substitution.
631df930be7SderaadtThe optional trailing
632df930be7Sderaadt.Cm g
633ff488c0dSjmccontinues to apply the substitution expression to the pathname substring,
634df930be7Sderaadtwhich starts with the first character following the end of the last successful
6358c926583Saaronsubstitution.
6368c926583SaaronThe first unsuccessful substitution stops the operation of the
637df930be7Sderaadt.Cm g
638df930be7Sderaadtoption.
639df930be7SderaadtThe optional trailing
640df930be7Sderaadt.Cm p
641df930be7Sderaadtwill cause the final result of a successful substitution to be written to
642cdba0873Saaronstandard error in the following format:
643df930be7Sderaadt.Dl <original pathname> >> <new pathname>
644df930be7SderaadtFile or archive member names that substitute to the empty string
645df930be7Sderaadtare not selected and will be skipped.
646df930be7Sderaadt.It Fl t
647df930be7SderaadtReset the access times of any file or directory read or accessed by
648f11c8a18Saaron.Nm
649df930be7Sderaadtto be the same as they were before being read or accessed by
650df930be7Sderaadt.Nm pax .
651df930be7Sderaadt.It Fl u
652df930be7SderaadtIgnore files that are older (having a less recent file modification time)
653df930be7Sderaadtthan a pre-existing file or archive member with the same name.
654df930be7SderaadtDuring
655df930be7Sderaadt.Em read ,
656df930be7Sderaadtan archive member with the same name as a file in the file system will be
657df930be7Sderaadtextracted if the archive member is newer than the file.
658df930be7SderaadtDuring
659df930be7Sderaadt.Em write ,
660df930be7Sderaadta file system member with the same name as an archive member will be
661df930be7Sderaadtwritten to the archive if it is newer than the archive member.
662df930be7SderaadtDuring
663df930be7Sderaadt.Em copy ,
664df930be7Sderaadtthe file in the destination hierarchy is replaced by the file in the source
665df930be7Sderaadthierarchy or by a link to the file in the source hierarchy if the file in
666df930be7Sderaadtthe source hierarchy is newer.
667df930be7Sderaadt.It Fl v
668df930be7SderaadtDuring a
669df930be7Sderaadt.Em list
670df930be7Sderaadtoperation, produce a verbose table of contents using the format of the
671df930be7Sderaadt.Xr ls 1
672df930be7Sderaadtutility with the
673df930be7Sderaadt.Fl l
674df930be7Sderaadtoption.
675df930be7SderaadtFor pathnames representing a hard link to a previous member of the archive,
676df930be7Sderaadtthe output has the format:
677df930be7Sderaadt.Dl <ls -l listing> == <link name>
678df930be7SderaadtFor pathnames representing a symbolic link, the output has the format:
679df930be7Sderaadt.Dl <ls -l listing> => <link name>
680df930be7SderaadtWhere <ls -l listing> is the output format specified by the
681df930be7Sderaadt.Xr ls 1
682df930be7Sderaadtutility when used with the
683df930be7Sderaadt.Fl l
684df930be7Sderaadtoption.
685f81d96dfSaaronOtherwise for all the other operational modes
686f81d96dfSaaron.Po Em read , write , Li and Em copy
687f81d96dfSaaron.Pc ,
688cdba0873Saaronpathnames are written and flushed to standard error
689cdba0873Saaronwithout a trailing newline
690df930be7Sderaadtas soon as processing begins on that file or
691df930be7Sderaadtarchive member.
692cdba0873SaaronThe trailing newline
693cdba0873Saaronis not buffered and is written only after the file has been read or written.
694df930be7Sderaadt.It Fl x Ar format
695df930be7SderaadtSpecify the output archive format, with the default format being
696df930be7Sderaadt.Ar ustar .
697f11c8a18Saaron.Nm
698df930be7Sderaadtcurrently supports the following formats:
699df930be7Sderaadt.Bl -tag -width "sv4cpio"
700df930be7Sderaadt.It Ar cpio
701df930be7SderaadtThe extended cpio interchange format specified in the
702df930be7Sderaadt.St -p1003.2
703df930be7Sderaadtstandard.
704df930be7SderaadtThe default blocksize for this format is 5120 bytes.
705df930be7SderaadtInode and device information about a file (used for detecting file hard links
706ff488c0dSjmcby this format), which may be truncated by this format, is detected by
707f11c8a18Saaron.Nm
708df930be7Sderaadtand is repaired.
709df930be7Sderaadt.It Ar bcpio
710df930be7SderaadtThe old binary cpio format.
711df930be7SderaadtThe default blocksize for this format is 5120 bytes.
712df930be7SderaadtThis format is not very portable and should not be used when other formats
713df930be7Sderaadtare available.
714df930be7SderaadtInode and device information about a file (used for detecting file hard links
715ff488c0dSjmcby this format), which may be truncated by this format, is detected by
716f11c8a18Saaron.Nm
717df930be7Sderaadtand is repaired.
718df930be7Sderaadt.It Ar sv4cpio
719df930be7SderaadtThe System V release 4 cpio.
720df930be7SderaadtThe default blocksize for this format is 5120 bytes.
721df930be7SderaadtInode and device information about a file (used for detecting file hard links
722ff488c0dSjmcby this format), which may be truncated by this format, is detected by
723f11c8a18Saaron.Nm
724df930be7Sderaadtand is repaired.
725df930be7Sderaadt.It Ar sv4crc
726df930be7SderaadtThe System V release 4 cpio with file crc checksums.
727df930be7SderaadtThe default blocksize for this format is 5120 bytes.
728df930be7SderaadtInode and device information about a file (used for detecting file hard links
729ff488c0dSjmcby this format), which may be truncated by this format, is detected by
730f11c8a18Saaron.Nm
731df930be7Sderaadtand is repaired.
732df930be7Sderaadt.It Ar tar
733df930be7SderaadtThe old BSD tar format as found in BSD4.3.
734df930be7SderaadtThe default blocksize for this format is 10240 bytes.
735df930be7SderaadtPathnames stored by this format must be 100 characters or less in length.
736df930be7SderaadtOnly
737df930be7Sderaadt.Em regular
738df930be7Sderaadtfiles,
739df930be7Sderaadt.Em hard links , soft links ,
740df930be7Sderaadtand
741df930be7Sderaadt.Em directories
742df930be7Sderaadtwill be archived (other file system types are not supported).
743df930be7SderaadtFor backwards compatibility with even older tar formats, a
744df930be7Sderaadt.Fl o
745df930be7Sderaadtoption can be used when writing an archive to omit the storage of directories.
746df930be7SderaadtThis option takes the form:
747df930be7Sderaadt.Dl Fl o Cm write_opt=nodir
748df930be7Sderaadt.It Ar ustar
749df930be7SderaadtThe extended tar interchange format specified in the
750df930be7Sderaadt.St -p1003.2
751df930be7Sderaadtstandard.
752df930be7SderaadtThe default blocksize for this format is 10240 bytes.
753*c1aa369bSjmcFilenames stored by this format must be 100 characters or less in length;
754*c1aa369bSjmcthe total pathname must be 255 characters or less.
755df930be7Sderaadt.El
756df930be7Sderaadt.Pp
757f11c8a18Saaron.Nm
758df930be7Sderaadtwill detect and report any file that it is unable to store or extract
759df930be7Sderaadtas the result of any specific archive format restrictions.
760df930be7SderaadtThe individual archive formats may impose additional restrictions on use.
761df930be7SderaadtTypical archive format restrictions include (but are not limited to):
762f81d96dfSaaronfile pathname length, file size, link pathname length, and the type of the
763f81d96dfSaaronfile.
76407ba6642Sderaadt.It Fl z
76507ba6642SderaadtUse
76607ba6642Sderaadt.Xr gzip 1
76707ba6642Sderaadtto compress (decompress) the archive while writing (reading).
76807ba6642SderaadtIncompatible with
76907ba6642Sderaadt.Fl a .
770df930be7Sderaadt.It Fl B Ar bytes
771df930be7SderaadtLimit the number of bytes written to a single archive volume to
772df930be7Sderaadt.Ar bytes .
773df930be7SderaadtThe
774df930be7Sderaadt.Ar bytes
775df930be7Sderaadtlimit can end with
776f81d96dfSaaron.Sq Li m ,
777f81d96dfSaaron.Sq Li k ,
778df930be7Sderaadtor
779f81d96dfSaaron.Sq Li b
780df930be7Sderaadtto specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
781df930be7SderaadtA pair of
782df930be7Sderaadt.Ar bytes
783df930be7Sderaadtlimits can be separated by
784f81d96dfSaaron.Sq Li x
785df930be7Sderaadtto indicate a product.
786df930be7Sderaadt.Pp
787df930be7Sderaadt.Em Warning :
788df930be7SderaadtOnly use this option when writing an archive to a device which supports
789df930be7Sderaadtan end of file read condition based on last (or largest) write offset
790df930be7Sderaadt(such as a regular file or a tape drive).
791df930be7SderaadtThe use of this option with a floppy or hard disk is not recommended.
792df930be7Sderaadt.It Fl D
793df930be7SderaadtThis option is the same as the
794df930be7Sderaadt.Fl u
795df930be7Sderaadtoption, except that the file inode change time is checked instead of the
796df930be7Sderaadtfile modification time.
797df930be7SderaadtThe file inode change time can be used to select files whose inode information
79842671979Saaron(e.g., UID, GID, etc.) is newer than a copy of the file in the destination
799df930be7Sderaadt.Ar directory .
800df930be7Sderaadt.It Fl E Ar limit
801df930be7SderaadtLimit the number of consecutive read faults while trying to read a flawed
802f81d96dfSaaronarchive to
803df930be7Sderaadt.Ar limit .
804df930be7SderaadtWith a positive
805df930be7Sderaadt.Ar limit ,
806f11c8a18Saaron.Nm
807df930be7Sderaadtwill attempt to recover from an archive read error and will
808df930be7Sderaadtcontinue processing starting with the next file stored in the archive.
809df930be7SderaadtA
810df930be7Sderaadt.Ar limit
811df930be7Sderaadtof 0 will cause
812f11c8a18Saaron.Nm
813df930be7Sderaadtto stop operation after the first read error is detected on an archive volume.
814df930be7SderaadtA
815df930be7Sderaadt.Ar limit
816df930be7Sderaadtof
817df930be7Sderaadt.Li NONE
818df930be7Sderaadtwill cause
819f11c8a18Saaron.Nm
820df930be7Sderaadtto attempt to recover from read errors forever.
821df930be7SderaadtThe default
822df930be7Sderaadt.Ar limit
823df930be7Sderaadtis a small positive number of retries.
824df930be7Sderaadt.Pp
825df930be7Sderaadt.Em Warning :
826df930be7SderaadtUsing this option with
827df930be7Sderaadt.Li NONE
828df930be7Sderaadtshould be used with extreme caution as
829f11c8a18Saaron.Nm
830df930be7Sderaadtmay get stuck in an infinite loop on a very badly flawed archive.
831df930be7Sderaadt.It Fl G Ar group
832df930be7SderaadtSelect a file based on its
833df930be7Sderaadt.Ar group
834df930be7Sderaadtname, or when starting with a
835df930be7Sderaadt.Cm # ,
836df930be7Sderaadta numeric gid.
837cdba0873SaaronA
838cdba0873Saaron.Ql \e
839cdba0873Saaroncan be used to escape the
840df930be7Sderaadt.Cm # .
841df930be7SderaadtMultiple
842df930be7Sderaadt.Fl G
843df930be7Sderaadtoptions may be supplied and checking stops with the first match.
844df930be7Sderaadt.It Fl H
845b4ad1291SaaronFollow only command-line symbolic links while performing a physical file
846df930be7Sderaadtsystem traversal.
847df930be7Sderaadt.It Fl L
848df930be7SderaadtFollow all symbolic links to perform a logical file system traversal.
849da60b202Smillert.It Fl O
850da60b202SmillertForce the archive to be one volume.
851da60b202SmillertIf a volume ends prematurely,
852da60b202Smillert.Nm
853da60b202Smillertwill not prompt for a new volume.
854da60b202SmillertThis option can be useful for
855da60b202Smillertautomated tasks where error recovery cannot be performed by a human.
856df930be7Sderaadt.It Fl P
857df930be7SderaadtDo not follow symbolic links, perform a physical file system traversal.
858df930be7SderaadtThis is the default mode.
859df930be7Sderaadt.It Fl T Ar [from_date][,to_date][/[c][m]]
860df930be7SderaadtAllow files to be selected based on a file modification or inode change
861df930be7Sderaadttime falling within a specified time range of
862df930be7Sderaadt.Ar from_date
863df930be7Sderaadtto
864df930be7Sderaadt.Ar to_date
865df930be7Sderaadt(the dates are inclusive).
866df930be7SderaadtIf only a
867df930be7Sderaadt.Ar from_date
868df930be7Sderaadtis supplied, all files with a modification or inode change time
869df930be7Sderaadtequal to or younger are selected.
870df930be7SderaadtIf only a
871df930be7Sderaadt.Ar to_date
872df930be7Sderaadtis supplied, all files with a modification or inode change time
873df930be7Sderaadtequal to or older will be selected.
874df930be7SderaadtWhen the
875df930be7Sderaadt.Ar from_date
876df930be7Sderaadtis equal to the
877df930be7Sderaadt.Ar to_date ,
878df930be7Sderaadtonly files with a modification or inode change time of exactly that
879df930be7Sderaadttime will be selected.
880df930be7Sderaadt.Pp
881df930be7SderaadtWhen
882f11c8a18Saaron.Nm
883df930be7Sderaadtis in the
884df930be7Sderaadt.Em write
885df930be7Sderaadtor
886df930be7Sderaadt.Em copy
887df930be7Sderaadtmode, the optional trailing field
888df930be7Sderaadt.Ar [c][m]
889df930be7Sderaadtcan be used to determine which file time (inode change, file modification or
890df930be7Sderaadtboth) are used in the comparison.
891df930be7SderaadtIf neither is specified, the default is to use file modification time only.
892df930be7SderaadtThe
893df930be7Sderaadt.Ar m
894df930be7Sderaadtspecifies the comparison of file modification time (the time when
895df930be7Sderaadtthe file was last written).
896df930be7SderaadtThe
897df930be7Sderaadt.Ar c
898df930be7Sderaadtspecifies the comparison of inode change time (the time when the file
89942671979Saaroninode was last changed; e.g., a change of owner, group, mode, etc).
900df930be7SderaadtWhen
901df930be7Sderaadt.Ar c
902df930be7Sderaadtand
903df930be7Sderaadt.Ar m
904df930be7Sderaadtare both specified, then the modification and inode change times are
905df930be7Sderaadtboth compared.
906df930be7SderaadtThe inode change time comparison is useful in selecting files whose
907df930be7Sderaadtattributes were recently changed or selecting files which were recently
908df930be7Sderaadtcreated and had their modification time reset to an older time (as what
909df930be7Sderaadthappens when a file is extracted from an archive and the modification time
910df930be7Sderaadtis preserved).
911df930be7SderaadtTime comparisons using both file times is useful when
912f11c8a18Saaron.Nm
913df930be7Sderaadtis used to create a time based incremental archive (only files that were
914df930be7Sderaadtchanged during a specified time range will be archived).
915df930be7Sderaadt.Pp
916df930be7SderaadtA time range is made up of six different fields and each field must contain two
917df930be7Sderaadtdigits.
918df930be7SderaadtThe format is:
919f04e0f38Smillert.Dl [[[[[cc]yy]mm]dd]HH]MM[.SS]
920df930be7SderaadtWhere
921f04e0f38Smillert.Cm cc
922f04e0f38Smillertis the first two digits of the year (the century),
923df930be7Sderaadt.Cm yy
924df930be7Sderaadtis the last two digits of the year,
925df930be7Sderaadtthe first
926df930be7Sderaadt.Cm mm
927df930be7Sderaadtis the month (from 01 to 12),
928df930be7Sderaadt.Cm dd
929df930be7Sderaadtis the day of the month (from 01 to 31),
930f04e0f38Smillert.Cm HH
931df930be7Sderaadtis the hour of the day (from 00 to 23),
932f04e0f38Smillert.Cm MM
933df930be7Sderaadtis the minute (from 00 to 59),
934df930be7Sderaadtand
935f04e0f38Smillert.Cm SS
936df930be7Sderaadtis the seconds (from 00 to 59).
937df930be7SderaadtThe minute field
938f04e0f38Smillert.Cm MM
939df930be7Sderaadtis required, while the other fields are optional and must be added in the
940df930be7Sderaadtfollowing order:
94120dcd35dSjmc.br
94220dcd35dSjmc.Cm \&	HH , dd , mm ,
94320dcd35dSjmc.Cm yy , cc .
94420dcd35dSjmc.br
945df930be7SderaadtThe
946f04e0f38Smillert.Cm SS
947df930be7Sderaadtfield may be added independently of the other fields.
948df930be7SderaadtTime ranges are relative to the current time, so
949df930be7Sderaadt.Dl Fl T Ar 1234/cm
950df930be7Sderaadtwould select all files with a modification or inode change time
951df930be7Sderaadtof 12:34 PM today or later.
952df930be7SderaadtMultiple
953df930be7Sderaadt.Fl T
954df930be7Sderaadttime range can be supplied and checking stops with the first match.
955df930be7Sderaadt.It Fl U Ar user
956df930be7SderaadtSelect a file based on its
957df930be7Sderaadt.Ar user
958df930be7Sderaadtname, or when starting with a
959df930be7Sderaadt.Cm # ,
960f81d96dfSaarona numeric UID.
961cdba0873SaaronA
962cdba0873Saaron.Ql \e
963cdba0873Saaroncan be used to escape the
964df930be7Sderaadt.Cm # .
965df930be7SderaadtMultiple
966df930be7Sderaadt.Fl U
967df930be7Sderaadtoptions may be supplied and checking stops with the first match.
968df930be7Sderaadt.It Fl X
969df930be7SderaadtWhen traversing the file hierarchy specified by a pathname,
970df930be7Sderaadtdo not descend into directories that have a different device ID.
971df930be7SderaadtSee the
972df930be7Sderaadt.Li st_dev
973df930be7Sderaadtfield as described in
974df930be7Sderaadt.Xr stat 2
975f81d96dfSaaronfor more information about device IDs.
976df930be7Sderaadt.It Fl Y
977df930be7SderaadtThis option is the same as the
978df930be7Sderaadt.Fl D
979df930be7Sderaadtoption, except that the inode change time is checked using the
980df930be7Sderaadtpathname created after all the file name modifications have completed.
981df930be7Sderaadt.It Fl Z
982df930be7SderaadtThis option is the same as the
983df930be7Sderaadt.Fl u
984df930be7Sderaadtoption, except that the modification time is checked using the
985df930be7Sderaadtpathname created after all the file name modifications have completed.
986df930be7Sderaadt.El
987df930be7Sderaadt.Pp
988f81d96dfSaaronThe options that operate on the names of files or archive members
989f81d96dfSaaron.Po Fl c ,
990df930be7Sderaadt.Fl i ,
991df930be7Sderaadt.Fl n ,
992df930be7Sderaadt.Fl s ,
993df930be7Sderaadt.Fl u ,
994df930be7Sderaadt.Fl v ,
995df930be7Sderaadt.Fl D ,
996df930be7Sderaadt.Fl G ,
997df930be7Sderaadt.Fl T ,
998df930be7Sderaadt.Fl U ,
999df930be7Sderaadt.Fl Y ,
1000df930be7Sderaadtand
1001f81d96dfSaaron.Fl Z
1002f81d96dfSaaron.Pc
1003df930be7Sderaadtinteract as follows.
1004df930be7Sderaadt.Pp
1005df930be7SderaadtWhen extracting files during a
1006df930be7Sderaadt.Em read
1007df930be7Sderaadtoperation, archive members are
1008df930be7Sderaadt.Sq selected ,
1009df930be7Sderaadtbased only on the user specified pattern operands as modified by the
1010df930be7Sderaadt.Fl c ,
1011df930be7Sderaadt.Fl n ,
1012df930be7Sderaadt.Fl u ,
1013df930be7Sderaadt.Fl D ,
1014df930be7Sderaadt.Fl G ,
1015df930be7Sderaadt.Fl T ,
1016df930be7Sderaadt.Fl U
1017df930be7Sderaadtoptions.
1018df930be7SderaadtThen any
1019df930be7Sderaadt.Fl s
1020df930be7Sderaadtand
1021df930be7Sderaadt.Fl i
1022df930be7Sderaadtoptions will modify in that order, the names of these selected files.
1023df930be7SderaadtThen the
1024df930be7Sderaadt.Fl Y
1025df930be7Sderaadtand
1026df930be7Sderaadt.Fl Z
1027df930be7Sderaadtoptions will be applied based on the final pathname.
1028f81d96dfSaaronFinally, the
1029df930be7Sderaadt.Fl v
1030df930be7Sderaadtoption will write the names resulting from these modifications.
1031df930be7Sderaadt.Pp
1032df930be7SderaadtWhen archiving files during a
1033df930be7Sderaadt.Em write
1034df930be7Sderaadtoperation, or copying files during a
1035df930be7Sderaadt.Em copy
1036df930be7Sderaadtoperation, archive members are
1037df930be7Sderaadt.Sq selected ,
1038df930be7Sderaadtbased only on the user specified pathnames as modified by the
1039df930be7Sderaadt.Fl n ,
1040df930be7Sderaadt.Fl u ,
1041df930be7Sderaadt.Fl D ,
1042df930be7Sderaadt.Fl G ,
1043df930be7Sderaadt.Fl T ,
1044df930be7Sderaadtand
1045df930be7Sderaadt.Fl U
1046df930be7Sderaadtoptions (the
1047df930be7Sderaadt.Fl D
1048df930be7Sderaadtoption only applies during a copy operation).
1049df930be7SderaadtThen any
1050df930be7Sderaadt.Fl s
1051df930be7Sderaadtand
1052df930be7Sderaadt.Fl i
1053df930be7Sderaadtoptions will modify in that order, the names of these selected files.
1054df930be7SderaadtThen during a
1055df930be7Sderaadt.Em copy
1056df930be7Sderaadtoperation the
1057df930be7Sderaadt.Fl Y
1058df930be7Sderaadtand the
1059df930be7Sderaadt.Fl Z
1060df930be7Sderaadtoptions will be applied based on the final pathname.
1061f81d96dfSaaronFinally, the
1062df930be7Sderaadt.Fl v
1063df930be7Sderaadtoption will write the names resulting from these modifications.
1064df930be7Sderaadt.Pp
1065df930be7SderaadtWhen one or both of the
1066df930be7Sderaadt.Fl u
1067df930be7Sderaadtor
1068df930be7Sderaadt.Fl D
1069df930be7Sderaadtoptions are specified along with the
1070df930be7Sderaadt.Fl n
1071df930be7Sderaadtoption, a file is not considered selected unless it is newer
1072df930be7Sderaadtthan the file to which it is compared.
10730cd08285Sjmc.Sh ENVIRONMENT
10740cd08285Sjmc.Bl -tag -width Fl
10750cd08285Sjmc.It Ev TMPDIR
10760cd08285SjmcPath in which to store temporary files.
10770cd08285Sjmc.El
1078df930be7Sderaadt.Sh EXAMPLES
1079cbab7b70Sderaadt.Li $ pax -w -f /dev/rst0 \&.
108093256fbcSaaron.Pp
108193256fbcSaaronCopies the contents of the current directory to the device
1082df930be7Sderaadt.Pa /dev/rst0 .
1083df930be7Sderaadt.Pp
1084cbab7b70Sderaadt.Li $ pax -v -f filename
108593256fbcSaaron.Pp
108693256fbcSaaronGives the verbose table of contents for an archive stored in
1087df930be7Sderaadt.Pa filename .
1088df930be7Sderaadt.Pp
1089cbab7b70Sderaadt.Li $ mkdir newdir ;
1090cbab7b70Sderaadt.Li cd olddir ;
1091cbab7b70Sderaadt.Li pax -rw \&. newdir
109293256fbcSaaron.Pp
109393256fbcSaaronThis sequence of commands will copy the entire
1094df930be7Sderaadt.Pa olddir
1095df930be7Sderaadtdirectory hierarchy to
1096df930be7Sderaadt.Pa newdir .
1097df930be7Sderaadt.Pp
1098cbab7b70Sderaadt.Li $ pax -r -s ',^//*usr//*,,' -f a.pax
109993256fbcSaaron.Pp
110093256fbcSaaronReads the archive
1101df930be7Sderaadt.Pa a.pax ,
1102b3119326Saaronwith all files rooted in
1103b3119326Saaron.Pa /usr
110493256fbcSaaroninto the archive extracted relative to the current directory.
1105df930be7Sderaadt.Pp
1106cbab7b70Sderaadt.Li $ pax -rw -i \&. dest_dir
110793256fbcSaaron.Pp
110893256fbcSaaronCan be used to interactively select the files to copy from the current
1109df930be7Sderaadtdirectory to
1110df930be7Sderaadt.Pa dest_dir .
1111df930be7Sderaadt.Pp
1112f158bb87Sjmc.Li "$ pax -r -pe -U root -G bin -f a.pax"
111393256fbcSaaron.Pp
111493256fbcSaaronExtract all files from the archive
1115df930be7Sderaadt.Pa a.pax
1116df930be7Sderaadtwhich are owned by
1117df930be7Sderaadt.Em root
1118df930be7Sderaadtwith group
1119df930be7Sderaadt.Em bin
112093256fbcSaaronand preserve all file permissions.
1121df930be7Sderaadt.Pp
1122cbab7b70Sderaadt.Li "$ pax -r -w -v -Y -Z home /backup"
112393256fbcSaaron.Pp
112493256fbcSaaronUpdate (and list) only those files in the destination directory
1125df930be7Sderaadt.Pa /backup
1126df930be7Sderaadtwhich are older (less recent inode change or file modification times) than
1127df930be7Sderaadtfiles with the same name found in the source file tree
1128df930be7Sderaadt.Pa home .
1129e3085f41Saaron.Sh DIAGNOSTICS
1130f11c8a18Saaron.Nm
1131df930be7Sderaadtwill exit with one of the following values:
1132df930be7Sderaadt.Bl -tag -width 2n
1133df930be7Sderaadt.It 0
1134df930be7SderaadtAll files were processed successfully.
1135df930be7Sderaadt.It 1
1136df930be7SderaadtAn error occurred.
1137df930be7Sderaadt.El
1138df930be7Sderaadt.Pp
1139df930be7SderaadtWhenever
1140f11c8a18Saaron.Nm
1141df930be7Sderaadtcannot create a file or a link when reading an archive or cannot
1142df930be7Sderaadtfind a file when writing an archive, or cannot preserve the user ID,
1143df930be7Sderaadtgroup ID, or file mode when the
1144df930be7Sderaadt.Fl p
1145cdba0873Saaronoption is specified, a diagnostic message is written to standard error
1146df930be7Sderaadtand a non-zero exit status will be returned, but processing will continue.
1147f81d96dfSaaronIn the case where
1148f11c8a18Saaron.Nm
1149f81d96dfSaaroncannot create a link to a file,
1150f11c8a18Saaron.Nm
1151df930be7Sderaadtwill not create a second copy of the file.
1152df930be7Sderaadt.Pp
1153df930be7SderaadtIf the extraction of a file from an archive is prematurely terminated by
1154df930be7Sderaadta signal or error,
1155f11c8a18Saaron.Nm
1156df930be7Sderaadtmay have only partially extracted a file the user wanted.
1157df930be7SderaadtAdditionally, the file modes of extracted files and directories
1158df930be7Sderaadtmay have incorrect file bits, and the modification and access times may be
1159df930be7Sderaadtwrong.
1160df930be7Sderaadt.Pp
1161df930be7SderaadtIf the creation of an archive is prematurely terminated by a signal or error,
1162f11c8a18Saaron.Nm
1163ff488c0dSjmcmay have only partially created the archive, which may violate the specific
1164df930be7Sderaadtarchive format specification.
1165df930be7Sderaadt.Pp
1166df930be7SderaadtIf while doing a
1167df930be7Sderaadt.Em copy ,
1168f11c8a18Saaron.Nm
1169df930be7Sderaadtdetects a file is about to overwrite itself, the file is not copied,
1170cdba0873Saarona diagnostic message is written to standard error
1171df930be7Sderaadtand when
1172f11c8a18Saaron.Nm
1173df930be7Sderaadtcompletes it will exit with a non-zero exit status.
1174e3085f41Saaron.Sh SEE ALSO
1175e3085f41Saaron.Xr cpio 1 ,
1176e3085f41Saaron.Xr tar 1
1177e3085f41Saaron.Sh STANDARDS
1178e3085f41SaaronThe
1179e3085f41Saaron.Nm
1180e3085f41Saaronutility is a superset of the
1181e3085f41Saaron.St -p1003.2
1182e3085f41Saaronstandard.
1183e3085f41SaaronThe options
1184e3085f41Saaron.Fl B ,
1185e3085f41Saaron.Fl D ,
1186e3085f41Saaron.Fl E ,
1187e3085f41Saaron.Fl G ,
1188e3085f41Saaron.Fl H ,
1189e3085f41Saaron.Fl L ,
1190da60b202Smillert.Fl O ,
1191e3085f41Saaron.Fl P ,
1192e3085f41Saaron.Fl T ,
1193e3085f41Saaron.Fl U ,
1194e3085f41Saaron.Fl Y ,
1195e3085f41Saaron.Fl Z ,
1196e3085f41Saaronthe archive formats
1197e3085f41Saaron.Ar bcpio ,
1198e3085f41Saaron.Ar sv4cpio ,
1199e3085f41Saaron.Ar sv4crc ,
1200e3085f41Saaron.Ar tar ,
1201e3085f41Saaronand the flawed archive handling during
1202e3085f41Saaron.Ar list
1203e3085f41Saaronand
1204e3085f41Saaron.Ar read
1205e3085f41Saaronoperations are extensions to the
1206e3085f41Saaron.Tn POSIX
1207e3085f41Saaronstandard.
12080cd08285Sjmc.Sh AUTHORS
12090cd08285SjmcKeith Muller at the University of California, San Diego.
1210