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