xref: /openbsd/bin/pax/pax.1 (revision b3119326)
1*b3119326Saaron.\"	$OpenBSD: pax.1,v 1.8 1998/11/06 00:34:09 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
43df930be7Sderaadt.Os BSD 4.4
44df930be7Sderaadt.Sh NAME
45df930be7Sderaadt.Nm pax
46df930be7Sderaadt.Nd read and write file archives and copy directory hierarchies
47df930be7Sderaadt.Sh SYNOPSIS
48df930be7Sderaadt.Nm pax
49df930be7Sderaadt.Op Fl cdnv
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 ...
74df930be7Sderaadt.Nm pax
75df930be7Sderaadt.Fl r
76df930be7Sderaadt.Op Fl cdiknuvDYZ
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 ...
110df930be7Sderaadt.Nm pax
111df930be7Sderaadt.Fl w
112df930be7Sderaadt.Op Fl dituvHLPX
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 ...
152df930be7Sderaadt.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
184f81d96dfSaaron.Nm pax
185df930be7Sderaadtwill read, write, and list the members of an archive file,
186df930be7Sderaadtand will copy directory hierarchies.
187f81d96dfSaaron.Nm pax
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
199df930be7Sderaadt.Nm pax
200df930be7Sderaadtwill operate under:
201df930be7Sderaadt.Em list , read , write ,
202df930be7Sderaadtand
203df930be7Sderaadt.Em copy .
204df930be7Sderaadt.Bl -tag -width 6n
205df930be7Sderaadt.It <none>
206df930be7Sderaadt.Em List .
207f81d96dfSaaron.Nm pax
208df930be7Sderaadtwill write to
209df930be7Sderaadt.Dv standard output
210df930be7Sderaadta table of contents of the members of the archive file read from
211df930be7Sderaadt.Dv standard input ,
212df930be7Sderaadtwhose pathnames match the specified
213df930be7Sderaadt.Ar patterns .
214df930be7SderaadtThe table of contents contains one filename per line
215df930be7Sderaadtand is written using single line buffering.
216df930be7Sderaadt.It Fl r
217df930be7Sderaadt.Em Read .
218f81d96dfSaaron.Nm pax
219df930be7Sderaadtextracts the members of the archive file read from the
220df930be7Sderaadt.Dv standard input ,
221df930be7Sderaadtwith pathnames matching the specified
222df930be7Sderaadt.Ar patterns .
223df930be7SderaadtThe archive format and blocking is automatically determined on input.
224df930be7SderaadtWhen an extracted file is a directory, the entire file hierarchy
225df930be7Sderaadtrooted at that directory is extracted.
226df930be7SderaadtAll extracted files are created relative to the current file hierarchy.
227df930be7SderaadtThe setting of ownership, access and modification times, and file mode of
228df930be7Sderaadtthe extracted files are discussed in more detail under the
229df930be7Sderaadt.Fl p
230df930be7Sderaadtoption.
231df930be7Sderaadt.It Fl w
232df930be7Sderaadt.Em Write .
233f81d96dfSaaron.Nm pax
234df930be7Sderaadtwrites an archive containing the
235df930be7Sderaadt.Ar file
236df930be7Sderaadtoperands to
237df930be7Sderaadt.Dv standard output
238df930be7Sderaadtusing the specified archive format.
239df930be7SderaadtWhen no
240df930be7Sderaadt.Ar file
241df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from
242df930be7Sderaadt.Dv standard input .
243df930be7SderaadtWhen a
244df930be7Sderaadt.Ar file
245df930be7Sderaadtoperand is also a directory, the entire file hierarchy rooted
246df930be7Sderaadtat that directory will be included.
247df930be7Sderaadt.It Fl r Fl w
248df930be7Sderaadt.Em Copy .
249f81d96dfSaaron.Nm pax
250df930be7Sderaadtcopies the
251df930be7Sderaadt.Ar file
252df930be7Sderaadtoperands to the destination
253df930be7Sderaadt.Ar directory .
254df930be7SderaadtWhen no
255df930be7Sderaadt.Ar file
256df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from
257df930be7Sderaadtthe
258df930be7Sderaadt.Dv standard input .
259df930be7SderaadtWhen a
260df930be7Sderaadt.Ar file
261df930be7Sderaadtoperand is also a directory the entire file
262df930be7Sderaadthierarchy rooted at that directory will be included.
263df930be7SderaadtThe effect of the
264df930be7Sderaadt.Em copy
265df930be7Sderaadtis as if the copied files were written to an archive file and then
266df930be7Sderaadtsubsequently extracted, except that there may be hard links between
267df930be7Sderaadtthe original and the copied files (see the
268df930be7Sderaadt.Fl l
269df930be7Sderaadtoption below).
270df930be7Sderaadt.Pp
271df930be7Sderaadt.Em Warning :
272df930be7SderaadtThe destination
273df930be7Sderaadt.Ar directory
274df930be7Sderaadtmust not be one of the
275df930be7Sderaadt.Ar file
276df930be7Sderaadtoperands or a member of a file hierarchy rooted at one of the
277df930be7Sderaadt.Ar file
278df930be7Sderaadtoperands.
279df930be7SderaadtThe result of a
280df930be7Sderaadt.Em copy
281df930be7Sderaadtunder these conditions is unpredictable.
282df930be7Sderaadt.El
283df930be7Sderaadt.Pp
284df930be7SderaadtWhile processing a damaged archive during a
285df930be7Sderaadt.Em read
286df930be7Sderaadtor
287df930be7Sderaadt.Em list
288df930be7Sderaadtoperation,
289df930be7Sderaadt.Nm pax
290df930be7Sderaadtwill attempt to recover from media defects and will search through the archive
291df930be7Sderaadtto locate and process the largest number of archive members possible (see the
292df930be7Sderaadt.Fl E
293df930be7Sderaadtoption for more details on error handling).
294df930be7Sderaadt.Sh OPERANDS
295df930be7SderaadtThe
296df930be7Sderaadt.Ar directory
297df930be7Sderaadtoperand specifies a destination directory pathname.
298df930be7SderaadtIf the
299df930be7Sderaadt.Ar directory
300df930be7Sderaadtoperand does not exist, or it is not writable by the user,
301df930be7Sderaadtor it is not of type directory,
302f81d96dfSaaron.Nm pax
303df930be7Sderaadtwill exit with a non-zero exit status.
304df930be7Sderaadt.Pp
305df930be7SderaadtThe
306df930be7Sderaadt.Ar pattern
307df930be7Sderaadtoperand is used to select one or more pathnames of archive members.
308df930be7SderaadtArchive members are selected using the pattern matching notation described
309df930be7Sderaadtby
310df930be7Sderaadt.Xr fnmatch 3 .
311df930be7SderaadtWhen the
312df930be7Sderaadt.Ar pattern
313df930be7Sderaadtoperand is not supplied, all members of the archive will be selected.
314df930be7SderaadtWhen a
315df930be7Sderaadt.Ar pattern
316df930be7Sderaadtmatches a directory, the entire file hierarchy rooted at that directory will
317df930be7Sderaadtbe selected.
318df930be7SderaadtWhen a
319df930be7Sderaadt.Ar pattern
320df930be7Sderaadtoperand does not select at least one archive member,
321df930be7Sderaadt.Nm pax
322df930be7Sderaadtwill write these
323df930be7Sderaadt.Ar pattern
324df930be7Sderaadtoperands in a diagnostic message to
325df930be7Sderaadt.Dv standard error
326df930be7Sderaadtand then exit with a non-zero exit status.
327df930be7Sderaadt.Pp
328df930be7SderaadtThe
329df930be7Sderaadt.Ar file
330df930be7Sderaadtoperand specifies the pathname of a file to be copied or archived.
331df930be7SderaadtWhen a
332df930be7Sderaadt.Ar file
333df930be7Sderaadtoperand does not select at least one archive member,
334df930be7Sderaadt.Nm pax
335df930be7Sderaadtwill write these
336df930be7Sderaadt.Ar file
337df930be7Sderaadtoperand pathnames in a diagnostic message to
338df930be7Sderaadt.Dv standard error
339df930be7Sderaadtand then exit with a non-zero exit status.
340df930be7Sderaadt.Sh OPTIONS
341df930be7SderaadtThe following options are supported:
342df930be7Sderaadt.Bl -tag -width 4n
343df930be7Sderaadt.It Fl r
344df930be7SderaadtRead an archive file from
345df930be7Sderaadt.Dv standard input
346df930be7Sderaadtand extract the specified
347df930be7Sderaadt.Ar files .
348df930be7SderaadtIf any intermediate directories are needed in order to extract an archive
349df930be7Sderaadtmember, these directories will be created as if
350df930be7Sderaadt.Xr mkdir 2
351df930be7Sderaadtwas called with the bitwise inclusive
352df930be7Sderaadt.Dv OR
353df930be7Sderaadtof
354df930be7Sderaadt.Dv S_IRWXU , S_IRWXG ,
355df930be7Sderaadtand
356df930be7Sderaadt.Dv S_IRWXO
357df930be7Sderaadtas the mode argument.
358df930be7SderaadtWhen the selected archive format supports the specification of linked
359df930be7Sderaadtfiles and these files cannot be linked while the archive is being extracted,
360df930be7Sderaadt.Nm pax
361df930be7Sderaadtwill write a diagnostic message to
362df930be7Sderaadt.Dv standard error
363df930be7Sderaadtand exit with a non-zero exit status at the completion of operation.
364df930be7Sderaadt.It Fl w
365df930be7SderaadtWrite files to the
366df930be7Sderaadt.Dv standard output
367df930be7Sderaadtin the specified archive format.
368df930be7SderaadtWhen no
369df930be7Sderaadt.Ar file
370df930be7Sderaadtoperands are specified,
371df930be7Sderaadt.Dv standard input
372df930be7Sderaadtis read for a list of pathnames with one per line without any leading or
373df930be7Sderaadttrailing
374df930be7Sderaadt.Aq blanks .
375df930be7Sderaadt.It Fl a
376df930be7SderaadtAppend
377df930be7Sderaadt.Ar files
378df930be7Sderaadtto the end of an archive that was previously written.
379df930be7SderaadtIf an archive format is not specified with a
380df930be7Sderaadt.Fl x
381df930be7Sderaadtoption, the format currently being used in the archive will be selected.
382df930be7SderaadtAny attempt to append to an archive in a format different from the
383df930be7Sderaadtformat already used in the archive will cause
384df930be7Sderaadt.Nm pax
385df930be7Sderaadtto exit immediately
386df930be7Sderaadtwith a non-zero exit status.
387df930be7SderaadtThe blocking size used in the archive volume where writing starts
388df930be7Sderaadtwill continue to be used for the remainder of that archive volume.
389df930be7Sderaadt.Pp
390df930be7Sderaadt.Em Warning :
391df930be7SderaadtMany storage devices are not able to support the operations necessary
392df930be7Sderaadtto perform an append operation.
393df930be7SderaadtAny attempt to append to an archive stored on such a device may damage the
394df930be7Sderaadtarchive or have other unpredictable results.
395df930be7SderaadtTape drives in particular are more likely to not support an append operation.
396df930be7SderaadtAn archive stored in a regular file system file or on a disk device will
397df930be7Sderaadtusually support an append operation.
398df930be7Sderaadt.It Fl b Ar blocksize
399df930be7SderaadtWhen
400df930be7Sderaadt.Em writing
401df930be7Sderaadtan archive,
402df930be7Sderaadtblock the output at a positive decimal integer number of
403df930be7Sderaadtbytes per write to the archive file.
404df930be7SderaadtThe
405df930be7Sderaadt.Ar blocksize
406ea4b1a1aSmillertmust be a multiple of 512 bytes with a maximum of 64512 bytes.
407ea4b1a1aSmillertArchives larger than 32256 bytes violate the
408ea4b1a1aSmillert.Tn POSIX
409ea4b1a1aSmillertstandard and will not be portable to all systems.
410df930be7SderaadtA
411df930be7Sderaadt.Ar blocksize
412df930be7Sderaadtcan end with
413f81d96dfSaaron.Sq Li k
414df930be7Sderaadtor
415f81d96dfSaaron.Sq Li b
416df930be7Sderaadtto specify multiplication by 1024 (1K) or 512, respectively.
417df930be7SderaadtA pair of
418df930be7Sderaadt.Ar blocksizes
419df930be7Sderaadtcan be separated by
420f81d96dfSaaron.Sq Li x
421df930be7Sderaadtto indicate a product.
422df930be7SderaadtA specific archive device may impose additional restrictions on the size
423df930be7Sderaadtof blocking it will support.
424df930be7SderaadtWhen blocking is not specified, the default
425df930be7Sderaadt.Ar blocksize
426df930be7Sderaadtis dependent on the specific archive format being used (see the
427df930be7Sderaadt.Fl x
428df930be7Sderaadtoption).
429df930be7Sderaadt.It Fl c
430df930be7SderaadtMatch all file or archive members
431df930be7Sderaadt.Em except
432df930be7Sderaadtthose specified by the
433df930be7Sderaadt.Ar pattern
434df930be7Sderaadtand
435df930be7Sderaadt.Ar file
436df930be7Sderaadtoperands.
437df930be7Sderaadt.It Fl d
438df930be7SderaadtCause files of type directory being copied or archived, or archive members of
439df930be7Sderaadttype directory being extracted, to match only the directory file or archive
440df930be7Sderaadtmember and not the file hierarchy rooted at the directory.
441df930be7Sderaadt.It Fl f Ar archive
442df930be7SderaadtSpecify
443df930be7Sderaadt.Ar archive
444df930be7Sderaadtas the pathname of the input or output archive, overriding the default
445df930be7Sderaadt.Dv standard input
446df930be7Sderaadt(for
447df930be7Sderaadt.Em list
448df930be7Sderaadtand
449df930be7Sderaadt.Em read )
450df930be7Sderaadtor
451df930be7Sderaadt.Dv standard output
452df930be7Sderaadt(for
453df930be7Sderaadt.Em write ) .
454df930be7SderaadtA single archive may span multiple files and different archive devices.
455df930be7SderaadtWhen required,
456df930be7Sderaadt.Nm pax
457df930be7Sderaadtwill prompt for the pathname of the file or device of the next volume in the
458df930be7Sderaadtarchive.
459df930be7Sderaadt.It Fl i
460df930be7SderaadtInteractively rename files or archive members.
461df930be7SderaadtFor each archive member matching a
462df930be7Sderaadt.Ar pattern
463df930be7Sderaadtoperand or each file matching a
464df930be7Sderaadt.Ar file
465df930be7Sderaadtoperand,
466df930be7Sderaadt.Nm pax
467df930be7Sderaadtwill prompt to
468df930be7Sderaadt.Pa /dev/tty
469df930be7Sderaadtgiving the name of the file, its file mode and its modification time.
470f81d96dfSaaron.Nm pax
471df930be7Sderaadtwill then read a line from
472df930be7Sderaadt.Pa /dev/tty .
473df930be7SderaadtIf this line is blank, the file or archive member is skipped.
474df930be7SderaadtIf this line consists of a single period, the
475df930be7Sderaadtfile or archive member is processed with no modification to its name.
476df930be7SderaadtOtherwise, its name is replaced with the contents of the line.
477f81d96dfSaaron.Nm pax
478df930be7Sderaadtwill immediately exit with a non-zero exit status if
479df930be7Sderaadt.Dv <EOF>
480df930be7Sderaadtis encountered when reading a response or if
481df930be7Sderaadt.Pa /dev/tty
482df930be7Sderaadtcannot be opened for reading and writing.
483df930be7Sderaadt.It Fl k
484df930be7SderaadtDo not overwrite existing files.
485df930be7Sderaadt.It Fl l
486*b3119326Saaron(The lowercase letter
487*b3119326Saaron.Dq ell. Ns )
488*b3119326SaaronLink files.
489df930be7SderaadtIn the
490df930be7Sderaadt.Em copy
491f81d96dfSaaronmode
492f81d96dfSaaron.Pq Fl r Fl w ,
493df930be7Sderaadthard links are made between the source and destination file hierarchies
494df930be7Sderaadtwhenever possible.
495df930be7Sderaadt.It Fl n
496df930be7SderaadtSelect the first archive member that matches each
497df930be7Sderaadt.Ar pattern
498df930be7Sderaadtoperand.
499df930be7SderaadtNo more than one archive member is matched for each
500df930be7Sderaadt.Ar pattern .
501df930be7SderaadtWhen members of type directory are matched, the file hierarchy rooted at that
502df930be7Sderaadtdirectory is also matched (unless
503df930be7Sderaadt.Fl d
504df930be7Sderaadtis also specified).
505df930be7Sderaadt.It Fl o Ar options
506df930be7SderaadtInformation to modify the algorithm for extracting or writing archive files
507df930be7Sderaadtwhich is specific to the archive format specified by
508df930be7Sderaadt.Fl x .
509df930be7SderaadtIn general,
510df930be7Sderaadt.Ar options
511df930be7Sderaadttake the form:
512f81d96dfSaaron.Cm name=value .
513df930be7Sderaadt.It Fl p Ar string
514df930be7SderaadtSpecify one or more file characteristic options (privileges).
515df930be7SderaadtThe
516df930be7Sderaadt.Ar string
517df930be7Sderaadtoption-argument is a string specifying file characteristics to be retained or
518df930be7Sderaadtdiscarded on extraction.
519df930be7SderaadtThe string consists of the specification characters
520df930be7Sderaadt.Cm a , e , m , o ,
521df930be7Sderaadtand
522df930be7Sderaadt.Cm p .
523df930be7SderaadtMultiple characteristics can be concatenated within the same string
524df930be7Sderaadtand multiple
525df930be7Sderaadt.Fl p
526df930be7Sderaadtoptions can be specified.
527df930be7SderaadtThe meaning of the specification characters are as follows:
528df930be7Sderaadt.Bl -tag -width 2n
529df930be7Sderaadt.It Cm a
530df930be7SderaadtDo not preserve file access times.
531df930be7SderaadtBy default, file access times are preserved whenever possible.
532df930be7Sderaadt.It Cm e
533df930be7Sderaadt.Sq Preserve everything ,
534df930be7Sderaadtthe user ID, group ID, file mode bits,
535df930be7Sderaadtfile access time, and file modification time.
536df930be7SderaadtThis is intended to be used by
537df930be7Sderaadt.Em root ,
538df930be7Sderaadtsomeone with all the appropriate privileges, in order to preserve all
539df930be7Sderaadtaspects of the files as they are recorded in the archive.
540df930be7SderaadtThe
541df930be7Sderaadt.Cm e
542df930be7Sderaadtflag is the sum of the
543df930be7Sderaadt.Cm o
544df930be7Sderaadtand
545df930be7Sderaadt.Cm p
546df930be7Sderaadtflags.
547df930be7Sderaadt.It Cm m
548df930be7SderaadtDo not preserve file modification times.
549df930be7SderaadtBy default, file modification times are preserved whenever possible.
550df930be7Sderaadt.It Cm o
551df930be7SderaadtPreserve the user ID and group ID.
552df930be7Sderaadt.It Cm p
553df930be7Sderaadt.Sq Preserve
554df930be7Sderaadtthe file mode bits.
555df930be7SderaadtThis intended to be used by a
556df930be7Sderaadt.Em user
557df930be7Sderaadtwith regular privileges who wants to preserve all aspects of the file other
558df930be7Sderaadtthan the ownership.
559df930be7SderaadtThe file times are preserved by default, but two other flags are offered to
560df930be7Sderaadtdisable this and use the time of extraction instead.
561df930be7Sderaadt.El
562df930be7Sderaadt.Pp
563df930be7SderaadtIn the preceding list,
564df930be7Sderaadt.Sq preserve
565df930be7Sderaadtindicates that an attribute stored in the archive is given to the
566df930be7Sderaadtextracted file, subject to the permissions of the invoking
567df930be7Sderaadtprocess.
568df930be7SderaadtOtherwise the attribute of the extracted file is determined as
569df930be7Sderaadtpart of the normal file creation action.
570df930be7SderaadtIf neither the
571df930be7Sderaadt.Cm e
572df930be7Sderaadtnor the
573df930be7Sderaadt.Cm o
574df930be7Sderaadtspecification character is specified, or the user ID and group ID are not
575df930be7Sderaadtpreserved for any reason,
576df930be7Sderaadt.Nm pax
577df930be7Sderaadtwill not set the
578df930be7Sderaadt.Dv S_ISUID
579df930be7Sderaadt.Em ( setuid )
580df930be7Sderaadtand
581df930be7Sderaadt.Dv S_ISGID
582df930be7Sderaadt.Em ( setgid )
583df930be7Sderaadtbits of the file mode.
584df930be7SderaadtIf the preservation of any of these items fails for any reason,
585df930be7Sderaadt.Nm pax
586df930be7Sderaadtwill write a diagnostic message to
587df930be7Sderaadt.Dv standard error .
588df930be7SderaadtFailure to preserve these items will affect the final exit status,
589df930be7Sderaadtbut will not cause the extracted file to be deleted.
590df930be7SderaadtIf the file characteristic letters in any of the string option-arguments are
591df930be7Sderaadtduplicated or conflict with each other, the one(s) given last will take
592df930be7Sderaadtprecedence.
593df930be7SderaadtFor example, if
594df930be7Sderaadt.Dl Fl p Ar eme
595df930be7Sderaadtis specified, file modification times are still preserved.
596df930be7Sderaadt.It Fl s Ar replstr
597df930be7SderaadtModify the file or archive member names specified by the
598df930be7Sderaadt.Ar pattern
599df930be7Sderaadtor
600df930be7Sderaadt.Ar file
601df930be7Sderaadtoperands according to the substitution expression
602df930be7Sderaadt.Ar replstr ,
603df930be7Sderaadtusing the syntax of the
604df930be7Sderaadt.Xr ed 1
605df930be7Sderaadtutility regular expressions.
606df930be7SderaadtThe format of these regular expressions are:
607df930be7Sderaadt.Dl /old/new/[gp]
608df930be7SderaadtAs in
609df930be7Sderaadt.Xr ed 1 ,
610df930be7Sderaadt.Cm old
611df930be7Sderaadtis a basic regular expression and
612df930be7Sderaadt.Cm new
613df930be7Sderaadtcan contain an ampersand (&), \\n (where n is a digit) back-references,
614df930be7Sderaadtor subexpression matching.
615df930be7SderaadtThe
616df930be7Sderaadt.Cm old
617df930be7Sderaadtstring may also contain
618df930be7Sderaadt.Dv <newline>
619df930be7Sderaadtcharacters.
620df930be7SderaadtAny non-null character can be used as a delimiter (/ is shown here).
621df930be7SderaadtMultiple
622df930be7Sderaadt.Fl s
623df930be7Sderaadtexpressions can be specified.
624df930be7SderaadtThe expressions are applied in the order they are specified on the
625df930be7Sderaadtcommand line, terminating with the first successful substitution.
626df930be7SderaadtThe optional trailing
627df930be7Sderaadt.Cm g
628df930be7Sderaadtcontinues to apply the substitution expression to the pathname substring
629df930be7Sderaadtwhich starts with the first character following the end of the last successful
630df930be7Sderaadtsubstitution. The first unsuccessful substitution stops the operation of the
631df930be7Sderaadt.Cm g
632df930be7Sderaadtoption.
633df930be7SderaadtThe optional trailing
634df930be7Sderaadt.Cm p
635df930be7Sderaadtwill cause the final result of a successful substitution to be written to
636df930be7Sderaadt.Dv standard error
637df930be7Sderaadtin the following format:
638df930be7Sderaadt.Dl <original pathname> >> <new pathname>
639df930be7SderaadtFile or archive member names that substitute to the empty string
640df930be7Sderaadtare not selected and will be skipped.
641df930be7Sderaadt.It Fl t
642df930be7SderaadtReset the access times of any file or directory read or accessed by
643df930be7Sderaadt.Nm pax
644df930be7Sderaadtto be the same as they were before being read or accessed by
645df930be7Sderaadt.Nm pax .
646df930be7Sderaadt.It Fl u
647df930be7SderaadtIgnore files that are older (having a less recent file modification time)
648df930be7Sderaadtthan a pre-existing file or archive member with the same name.
649df930be7SderaadtDuring
650df930be7Sderaadt.Em read ,
651df930be7Sderaadtan archive member with the same name as a file in the file system will be
652df930be7Sderaadtextracted if the archive member is newer than the file.
653df930be7SderaadtDuring
654df930be7Sderaadt.Em write ,
655df930be7Sderaadta file system member with the same name as an archive member will be
656df930be7Sderaadtwritten to the archive if it is newer than the archive member.
657df930be7SderaadtDuring
658df930be7Sderaadt.Em copy ,
659df930be7Sderaadtthe file in the destination hierarchy is replaced by the file in the source
660df930be7Sderaadthierarchy or by a link to the file in the source hierarchy if the file in
661df930be7Sderaadtthe source hierarchy is newer.
662df930be7Sderaadt.It Fl v
663df930be7SderaadtDuring a
664df930be7Sderaadt.Em list
665df930be7Sderaadtoperation, produce a verbose table of contents using the format of the
666df930be7Sderaadt.Xr ls 1
667df930be7Sderaadtutility with the
668df930be7Sderaadt.Fl l
669df930be7Sderaadtoption.
670df930be7SderaadtFor pathnames representing a hard link to a previous member of the archive,
671df930be7Sderaadtthe output has the format:
672df930be7Sderaadt.Dl <ls -l listing> == <link name>
673df930be7SderaadtFor pathnames representing a symbolic link, the output has the format:
674df930be7Sderaadt.Dl <ls -l listing> => <link name>
675df930be7SderaadtWhere <ls -l listing> is the output format specified by the
676df930be7Sderaadt.Xr ls 1
677df930be7Sderaadtutility when used with the
678df930be7Sderaadt.Fl l
679df930be7Sderaadtoption.
680f81d96dfSaaronOtherwise for all the other operational modes
681f81d96dfSaaron.Po Em read , write , Li and Em copy
682f81d96dfSaaron.Pc ,
683df930be7Sderaadtpathnames are written and flushed to
684df930be7Sderaadt.Dv standard error
685df930be7Sderaadtwithout a trailing
686df930be7Sderaadt.Dv <newline>
687df930be7Sderaadtas soon as processing begins on that file or
688df930be7Sderaadtarchive member.
689df930be7SderaadtThe trailing
690df930be7Sderaadt.Dv <newline> ,
691df930be7Sderaadtis not buffered, and is written only after the file has been read or written.
692df930be7Sderaadt.It Fl x Ar format
693df930be7SderaadtSpecify the output archive format, with the default format being
694df930be7Sderaadt.Ar ustar .
695f81d96dfSaaron.Nm pax
696df930be7Sderaadtcurrently supports the following formats:
697df930be7Sderaadt.Bl -tag -width "sv4cpio"
698df930be7Sderaadt.It Ar cpio
699df930be7SderaadtThe extended cpio interchange format specified in the
700df930be7Sderaadt.St -p1003.2
701df930be7Sderaadtstandard.
702df930be7SderaadtThe default blocksize for this format is 5120 bytes.
703df930be7SderaadtInode and device information about a file (used for detecting file hard links
704df930be7Sderaadtby this format) which may be truncated by this format is detected by
705df930be7Sderaadt.Nm pax
706df930be7Sderaadtand is repaired.
707df930be7Sderaadt.It Ar bcpio
708df930be7SderaadtThe old binary cpio format.
709df930be7SderaadtThe default blocksize for this format is 5120 bytes.
710df930be7SderaadtThis format is not very portable and should not be used when other formats
711df930be7Sderaadtare available.
712df930be7SderaadtInode and device information about a file (used for detecting file hard links
713df930be7Sderaadtby this format) which may be truncated by this format is detected by
714df930be7Sderaadt.Nm pax
715df930be7Sderaadtand is repaired.
716df930be7Sderaadt.It Ar sv4cpio
717df930be7SderaadtThe System V release 4 cpio.
718df930be7SderaadtThe default blocksize for this format is 5120 bytes.
719df930be7SderaadtInode and device information about a file (used for detecting file hard links
720df930be7Sderaadtby this format) which may be truncated by this format is detected by
721df930be7Sderaadt.Nm pax
722df930be7Sderaadtand is repaired.
723df930be7Sderaadt.It Ar sv4crc
724df930be7SderaadtThe System V release 4 cpio with file crc checksums.
725df930be7SderaadtThe default blocksize for this format is 5120 bytes.
726df930be7SderaadtInode and device information about a file (used for detecting file hard links
727df930be7Sderaadtby this format) which may be truncated by this format is detected by
728df930be7Sderaadt.Nm pax
729df930be7Sderaadtand is repaired.
730df930be7Sderaadt.It Ar tar
731df930be7SderaadtThe old BSD tar format as found in BSD4.3.
732df930be7SderaadtThe default blocksize for this format is 10240 bytes.
733df930be7SderaadtPathnames stored by this format must be 100 characters or less in length.
734df930be7SderaadtOnly
735df930be7Sderaadt.Em regular
736df930be7Sderaadtfiles,
737df930be7Sderaadt.Em  hard links , soft links ,
738df930be7Sderaadtand
739df930be7Sderaadt.Em  directories
740df930be7Sderaadtwill be archived (other file system types are not supported).
741df930be7SderaadtFor backwards compatibility with even older tar formats, a
742df930be7Sderaadt.Fl o
743df930be7Sderaadtoption can be used when writing an archive to omit the storage of directories.
744df930be7SderaadtThis option takes the form:
745df930be7Sderaadt.Dl Fl o Cm write_opt=nodir
746df930be7Sderaadt.It Ar ustar
747df930be7SderaadtThe extended tar interchange format specified in the
748df930be7Sderaadt.St -p1003.2
749df930be7Sderaadtstandard.
750df930be7SderaadtThe default blocksize for this format is 10240 bytes.
751df930be7SderaadtPathnames stored by this format must be 250 characters or less in length.
752df930be7Sderaadt.El
753df930be7Sderaadt.Pp
754f81d96dfSaaron.Nm pax
755df930be7Sderaadtwill detect and report any file that it is unable to store or extract
756df930be7Sderaadtas the result of any specific archive format restrictions.
757df930be7SderaadtThe individual archive formats may impose additional restrictions on use.
758df930be7SderaadtTypical archive format restrictions include (but are not limited to):
759f81d96dfSaaronfile pathname length, file size, link pathname length, and the type of the
760f81d96dfSaaronfile.
761df930be7Sderaadt.It Fl B Ar bytes
762df930be7SderaadtLimit the number of bytes written to a single archive volume to
763df930be7Sderaadt.Ar bytes .
764df930be7SderaadtThe
765df930be7Sderaadt.Ar bytes
766df930be7Sderaadtlimit can end with
767f81d96dfSaaron.Sq Li m ,
768f81d96dfSaaron.Sq Li k ,
769df930be7Sderaadtor
770f81d96dfSaaron.Sq Li b
771df930be7Sderaadtto specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
772df930be7SderaadtA pair of
773df930be7Sderaadt.Ar bytes
774df930be7Sderaadtlimits can be separated by
775f81d96dfSaaron.Sq Li x
776df930be7Sderaadtto indicate a product.
777df930be7Sderaadt.Pp
778df930be7Sderaadt.Em Warning :
779df930be7SderaadtOnly use this option when writing an archive to a device which supports
780df930be7Sderaadtan end of file read condition based on last (or largest) write offset
781df930be7Sderaadt(such as a regular file or a tape drive).
782df930be7SderaadtThe use of this option with a floppy or hard disk is not recommended.
783df930be7Sderaadt.It Fl D
784df930be7SderaadtThis option is the same as the
785df930be7Sderaadt.Fl u
786df930be7Sderaadtoption, except that the file inode change time is checked instead of the
787df930be7Sderaadtfile modification time.
788df930be7SderaadtThe file inode change time can be used to select files whose inode information
789f81d96dfSaaron(e.g. UID, GID, etc.) is newer than a copy of the file in the destination
790df930be7Sderaadt.Ar directory .
791df930be7Sderaadt.It Fl E Ar limit
792df930be7SderaadtLimit the number of consecutive read faults while trying to read a flawed
793f81d96dfSaaronarchive to
794df930be7Sderaadt.Ar limit .
795df930be7SderaadtWith a positive
796df930be7Sderaadt.Ar limit ,
797df930be7Sderaadt.Nm pax
798df930be7Sderaadtwill attempt to recover from an archive read error and will
799df930be7Sderaadtcontinue processing starting with the next file stored in the archive.
800df930be7SderaadtA
801df930be7Sderaadt.Ar limit
802df930be7Sderaadtof 0 will cause
803df930be7Sderaadt.Nm pax
804df930be7Sderaadtto stop operation after the first read error is detected on an archive volume.
805df930be7SderaadtA
806df930be7Sderaadt.Ar limit
807df930be7Sderaadtof
808df930be7Sderaadt.Li NONE
809df930be7Sderaadtwill cause
810df930be7Sderaadt.Nm pax
811df930be7Sderaadtto attempt to recover from read errors forever.
812df930be7SderaadtThe default
813df930be7Sderaadt.Ar limit
814df930be7Sderaadtis a small positive number of retries.
815df930be7Sderaadt.Pp
816df930be7Sderaadt.Em Warning:
817df930be7SderaadtUsing this option with
818df930be7Sderaadt.Li NONE
819df930be7Sderaadtshould be used with extreme caution as
820df930be7Sderaadt.Nm pax
821df930be7Sderaadtmay get stuck in an infinite loop on a very badly flawed archive.
822df930be7Sderaadt.It Fl G Ar group
823df930be7SderaadtSelect a file based on its
824df930be7Sderaadt.Ar group
825df930be7Sderaadtname, or when starting with a
826df930be7Sderaadt.Cm # ,
827df930be7Sderaadta numeric gid.
828df930be7SderaadtA '\\' can be used to escape the
829df930be7Sderaadt.Cm # .
830df930be7SderaadtMultiple
831df930be7Sderaadt.Fl G
832df930be7Sderaadtoptions may be supplied and checking stops with the first match.
833df930be7Sderaadt.It Fl H
834df930be7SderaadtFollow only command line symbolic links while performing a physical file
835df930be7Sderaadtsystem traversal.
836df930be7Sderaadt.It Fl L
837df930be7SderaadtFollow all symbolic links to perform a logical file system traversal.
838df930be7Sderaadt.It Fl P
839df930be7SderaadtDo not follow symbolic links, perform a physical file system traversal.
840df930be7SderaadtThis is the default mode.
841df930be7Sderaadt.It Fl T Ar [from_date][,to_date][/[c][m]]
842df930be7SderaadtAllow files to be selected based on a file modification or inode change
843df930be7Sderaadttime falling within a specified time range of
844df930be7Sderaadt.Ar from_date
845df930be7Sderaadtto
846df930be7Sderaadt.Ar to_date
847df930be7Sderaadt(the dates are inclusive).
848df930be7SderaadtIf only a
849df930be7Sderaadt.Ar from_date
850df930be7Sderaadtis supplied, all files with a modification or inode change time
851df930be7Sderaadtequal to or younger are selected.
852df930be7SderaadtIf only a
853df930be7Sderaadt.Ar to_date
854df930be7Sderaadtis supplied, all files with a modification or inode change time
855df930be7Sderaadtequal to or older will be selected.
856df930be7SderaadtWhen the
857df930be7Sderaadt.Ar from_date
858df930be7Sderaadtis equal to the
859df930be7Sderaadt.Ar to_date ,
860df930be7Sderaadtonly files with a modification or inode change time of exactly that
861df930be7Sderaadttime will be selected.
862df930be7Sderaadt.Pp
863df930be7SderaadtWhen
864df930be7Sderaadt.Nm pax
865df930be7Sderaadtis in the
866df930be7Sderaadt.Em write
867df930be7Sderaadtor
868df930be7Sderaadt.Em copy
869df930be7Sderaadtmode, the optional trailing field
870df930be7Sderaadt.Ar [c][m]
871df930be7Sderaadtcan be used to determine which file time (inode change, file modification or
872df930be7Sderaadtboth) are used in the comparison.
873df930be7SderaadtIf neither is specified, the default is to use file modification time only.
874df930be7SderaadtThe
875df930be7Sderaadt.Ar m
876df930be7Sderaadtspecifies the comparison of file modification time (the time when
877df930be7Sderaadtthe file was last written).
878df930be7SderaadtThe
879df930be7Sderaadt.Ar c
880df930be7Sderaadtspecifies the comparison of inode change time (the time when the file
881df930be7Sderaadtinode was last changed; e.g. a change of owner, group, mode, etc).
882df930be7SderaadtWhen
883df930be7Sderaadt.Ar c
884df930be7Sderaadtand
885df930be7Sderaadt.Ar m
886df930be7Sderaadtare both specified, then the modification and inode change times are
887df930be7Sderaadtboth compared.
888df930be7SderaadtThe inode change time comparison is useful in selecting files whose
889df930be7Sderaadtattributes were recently changed or selecting files which were recently
890df930be7Sderaadtcreated and had their modification time reset to an older time (as what
891df930be7Sderaadthappens when a file is extracted from an archive and the modification time
892df930be7Sderaadtis preserved).
893df930be7SderaadtTime comparisons using both file times is useful when
894df930be7Sderaadt.Nm pax
895df930be7Sderaadtis used to create a time based incremental archive (only files that were
896df930be7Sderaadtchanged during a specified time range will be archived).
897df930be7Sderaadt.Pp
898df930be7SderaadtA time range is made up of six different fields and each field must contain two
899df930be7Sderaadtdigits.
900df930be7SderaadtThe format is:
901df930be7Sderaadt.Dl [yy[mm[dd[hh]]]]mm[.ss]
902df930be7SderaadtWhere
903df930be7Sderaadt.Cm yy
904df930be7Sderaadtis the last two digits of the year,
905df930be7Sderaadtthe first
906df930be7Sderaadt.Cm mm
907df930be7Sderaadtis the month (from 01 to 12),
908df930be7Sderaadt.Cm dd
909df930be7Sderaadtis the day of the month (from 01 to 31),
910df930be7Sderaadt.Cm hh
911df930be7Sderaadtis the hour of the day (from 00 to 23),
912df930be7Sderaadtthe second
913df930be7Sderaadt.Cm mm
914df930be7Sderaadtis the minute (from 00 to 59),
915df930be7Sderaadtand
916df930be7Sderaadt.Cm ss
917df930be7Sderaadtis the seconds (from 00 to 59).
918df930be7SderaadtThe minute field
919df930be7Sderaadt.Cm mm
920df930be7Sderaadtis required, while the other fields are optional and must be added in the
921df930be7Sderaadtfollowing order:
922df930be7Sderaadt.Dl Cm hh , dd , mm , yy .
923df930be7SderaadtThe
924df930be7Sderaadt.Cm ss
925df930be7Sderaadtfield may be added independently of the other fields.
926df930be7SderaadtTime ranges are relative to the current time, so
927df930be7Sderaadt.Dl Fl T Ar 1234/cm
928df930be7Sderaadtwould select all files with a modification or inode change time
929df930be7Sderaadtof 12:34 PM today or later.
930df930be7SderaadtMultiple
931df930be7Sderaadt.Fl T
932df930be7Sderaadttime range can be supplied and checking stops with the first match.
933df930be7Sderaadt.It Fl U Ar user
934df930be7SderaadtSelect a file based on its
935df930be7Sderaadt.Ar user
936df930be7Sderaadtname, or when starting with a
937df930be7Sderaadt.Cm # ,
938f81d96dfSaarona numeric UID.
939df930be7SderaadtA '\\' can 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
1050df930be7SderaadtThe command:
1051df930be7Sderaadt.Dl pax -w -f /dev/rst0 .\
1052df930be7Sderaadtcopies the contents of the current directory to the device
1053df930be7Sderaadt.Pa /dev/rst0 .
1054df930be7Sderaadt.Pp
1055df930be7SderaadtThe command:
1056fa67a890Stholo.Dl pax -v -f filename
1057df930be7Sderaadtgives the verbose table of contents for an archive stored in
1058df930be7Sderaadt.Pa filename .
1059df930be7Sderaadt.Pp
1060df930be7SderaadtThe following commands:
1061df930be7Sderaadt.Dl mkdir newdir
1062df930be7Sderaadt.Dl cd olddir
1063df930be7Sderaadt.Dl pax -rw .\ newdir
1064df930be7Sderaadtwill copy the entire
1065df930be7Sderaadt.Pa olddir
1066df930be7Sderaadtdirectory hierarchy to
1067df930be7Sderaadt.Pa newdir .
1068df930be7Sderaadt.Pp
1069df930be7SderaadtThe command:
1070df930be7Sderaadt.Dl pax -r -s ',^//*usr//*,,' -f a.pax
1071df930be7Sderaadtreads the archive
1072df930be7Sderaadt.Pa a.pax ,
1073*b3119326Saaronwith all files rooted in
1074*b3119326Saaron.Pa /usr
1075*b3119326Saaroninto the archive extracted relative to the
1076df930be7Sderaadtcurrent directory.
1077df930be7Sderaadt.Pp
1078df930be7SderaadtThe command:
1079df930be7Sderaadt.Dl pax -rw -i .\ dest_dir
1080df930be7Sderaadtcan be used to interactively select the files to copy from the current
1081df930be7Sderaadtdirectory to
1082df930be7Sderaadt.Pa dest_dir .
1083df930be7Sderaadt.Pp
1084df930be7SderaadtThe command:
1085df930be7Sderaadt.Dl pax -r -pe -U root -G bin -f a.pax
1086df930be7Sderaadtwill extract all files from the archive
1087df930be7Sderaadt.Pa a.pax
1088df930be7Sderaadtwhich are owned by
1089df930be7Sderaadt.Em root
1090df930be7Sderaadtwith group
1091df930be7Sderaadt.Em bin
1092df930be7Sderaadtand will preserve all file permissions.
1093df930be7Sderaadt.Pp
1094df930be7SderaadtThe command:
1095df930be7Sderaadt.Dl pax -r -w -v -Y -Z home /backup
1096df930be7Sderaadtwill update (and list) only those files in the destination directory
1097df930be7Sderaadt.Pa /backup
1098df930be7Sderaadtwhich are older (less recent inode change or file modification times) than
1099df930be7Sderaadtfiles with the same name found in the source file tree
1100df930be7Sderaadt.Pa home .
1101df930be7Sderaadt.Sh STANDARDS
1102df930be7SderaadtThe
1103df930be7Sderaadt.Nm pax
1104df930be7Sderaadtutility is a superset of the
1105df930be7Sderaadt.St -p1003.2
1106df930be7Sderaadtstandard.
1107df930be7SderaadtThe options
1108df930be7Sderaadt.Fl B ,
1109df930be7Sderaadt.Fl D ,
1110df930be7Sderaadt.Fl E ,
1111df930be7Sderaadt.Fl G ,
1112df930be7Sderaadt.Fl H ,
1113df930be7Sderaadt.Fl L ,
1114df930be7Sderaadt.Fl P ,
1115df930be7Sderaadt.Fl T ,
1116df930be7Sderaadt.Fl U ,
1117df930be7Sderaadt.Fl Y ,
1118df930be7Sderaadt.Fl Z ,
1119df930be7Sderaadtthe archive formats
1120df930be7Sderaadt.Ar bcpio ,
1121df930be7Sderaadt.Ar sv4cpio ,
1122df930be7Sderaadt.Ar sv4crc ,
1123df930be7Sderaadt.Ar tar ,
1124df930be7Sderaadtand the flawed archive handling during
1125df930be7Sderaadt.Ar list
1126df930be7Sderaadtand
1127df930be7Sderaadt.Ar read
1128df930be7Sderaadtoperations are extensions to the
1129df930be7Sderaadt.Tn POSIX
1130df930be7Sderaadtstandard.
113119e7eef2Stholo.Sh SEE ALSO
1132ca961342Saaron.Xr cpio 1 ,
1133ca961342Saaron.Xr tar 1
1134df930be7Sderaadt.Sh AUTHOR
1135f81d96dfSaaronKeith Muller at the University of California, San Diego.
1136df930be7Sderaadt.Sh ERRORS
1137df930be7Sderaadt.Nm pax
1138df930be7Sderaadtwill exit with one of the following values:
1139df930be7Sderaadt.Bl -tag -width 2n
1140df930be7Sderaadt.It 0
1141df930be7SderaadtAll files were processed successfully.
1142df930be7Sderaadt.It 1
1143df930be7SderaadtAn error occurred.
1144df930be7Sderaadt.El
1145df930be7Sderaadt.Pp
1146df930be7SderaadtWhenever
1147df930be7Sderaadt.Nm pax
1148df930be7Sderaadtcannot create a file or a link when reading an archive or cannot
1149df930be7Sderaadtfind a file when writing an archive, or cannot preserve the user ID,
1150df930be7Sderaadtgroup ID, or file mode when the
1151df930be7Sderaadt.Fl p
1152df930be7Sderaadtoption is specified, a diagnostic message is written to
1153df930be7Sderaadt.Dv standard error
1154df930be7Sderaadtand a non-zero exit status will be returned, but processing will continue.
1155f81d96dfSaaronIn the case where
1156f81d96dfSaaron.Nm pax
1157f81d96dfSaaroncannot create a link to a file,
1158df930be7Sderaadt.Nm pax
1159df930be7Sderaadtwill not create a second copy of the file.
1160df930be7Sderaadt.Pp
1161df930be7SderaadtIf the extraction of a file from an archive is prematurely terminated by
1162df930be7Sderaadta signal or error,
1163df930be7Sderaadt.Nm pax
1164df930be7Sderaadtmay have only partially extracted a file the user wanted.
1165df930be7SderaadtAdditionally, the file modes of extracted files and directories
1166df930be7Sderaadtmay have incorrect file bits, and the modification and access times may be
1167df930be7Sderaadtwrong.
1168df930be7Sderaadt.Pp
1169df930be7SderaadtIf the creation of an archive is prematurely terminated by a signal or error,
1170df930be7Sderaadt.Nm pax
1171df930be7Sderaadtmay have only partially created the archive which may violate the specific
1172df930be7Sderaadtarchive format specification.
1173df930be7Sderaadt.Pp
1174df930be7SderaadtIf while doing a
1175df930be7Sderaadt.Em copy ,
1176df930be7Sderaadt.Nm pax
1177df930be7Sderaadtdetects a file is about to overwrite itself, the file is not copied,
1178df930be7Sderaadta diagnostic message is written to
1179df930be7Sderaadt.Dv standard error
1180df930be7Sderaadtand when
1181df930be7Sderaadt.Nm pax
1182df930be7Sderaadtcompletes it will exit with a non-zero exit status.
1183