xref: /openbsd/bin/pax/pax.1 (revision d273926b)
1*d273926bSschwarze.\"	$OpenBSD: pax.1,v 1.72 2016/08/16 18:41:06 schwarze Exp $
2df930be7Sderaadt.\"	$NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
3df930be7Sderaadt.\"
4df930be7Sderaadt.\" Copyright (c) 1992 Keith Muller.
5df930be7Sderaadt.\" Copyright (c) 1992, 1993
6df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
7df930be7Sderaadt.\"
8df930be7Sderaadt.\" This code is derived from software contributed to Berkeley by
9df930be7Sderaadt.\" Keith Muller of the University of California, San Diego.
10df930be7Sderaadt.\"
11df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
12df930be7Sderaadt.\" modification, are permitted provided that the following conditions
13df930be7Sderaadt.\" are met:
14df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
15df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
16df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
17df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
18df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
1929295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
20df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
21df930be7Sderaadt.\"    without specific prior written permission.
22df930be7Sderaadt.\"
23df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33df930be7Sderaadt.\" SUCH DAMAGE.
34df930be7Sderaadt.\"
35df930be7Sderaadt.\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
36df930be7Sderaadt.\"
37*d273926bSschwarze.Dd $Mdocdate: August 16 2016 $
38df930be7Sderaadt.Dt PAX 1
39fc8533a3Saaron.Os
40df930be7Sderaadt.Sh NAME
41df930be7Sderaadt.Nm pax
42df930be7Sderaadt.Nd read and write file archives and copy directory hierarchies
43df930be7Sderaadt.Sh SYNOPSIS
44189213daSderaadt.Nm pax
45a914b46dSpvalchev.Op Fl 0cdjnOvz
46d9bd2a6bSjaredy.Op Fl E Ar limit
47df930be7Sderaadt.Op Fl f Ar archive
48df930be7Sderaadt.Op Fl G Ar group
49d9bd2a6bSjaredy.Op Fl s Ar replstr
50d9bd2a6bSjaredy.Op Fl T Ar range
51d9bd2a6bSjaredy.Op Fl U Ar user
52df930be7Sderaadt.Op Ar pattern ...
53189213daSderaadt.Nm pax
54df930be7Sderaadt.Fl r
55a914b46dSpvalchev.Op Fl 0cDdijknOuvYZz
56df930be7Sderaadt.Op Fl E Ar limit
57d9bd2a6bSjaredy.Op Fl f Ar archive
58df930be7Sderaadt.Op Fl G Ar group
59d9bd2a6bSjaredy.Op Fl o Ar options
60d9bd2a6bSjaredy.Op Fl p Ar string
61d9bd2a6bSjaredy.Op Fl s Ar replstr
62d9bd2a6bSjaredy.Op Fl T Ar range
63d9bd2a6bSjaredy.Op Fl U Ar user
64df930be7Sderaadt.Op Ar pattern ...
65189213daSderaadt.Nm pax
66df930be7Sderaadt.Fl w
67a914b46dSpvalchev.Op Fl 0adHijLOPtuvXz
68df930be7Sderaadt.Op Fl B Ar bytes
69d9bd2a6bSjaredy.Op Fl b Ar blocksize
70d9bd2a6bSjaredy.Op Fl f Ar archive
71d9bd2a6bSjaredy.Op Fl G Ar group
72d9bd2a6bSjaredy.Op Fl o Ar options
73d9bd2a6bSjaredy.Op Fl s Ar replstr
74d9bd2a6bSjaredy.Op Fl T Ar range
75d9bd2a6bSjaredy.Op Fl U Ar user
76d9bd2a6bSjaredy.Op Fl x Ar format
77679f6f8fSsobrado.Op Ar
78189213daSderaadt.Nm pax
79bb4196c7Sjmc.Fl rw
80a914b46dSpvalchev.Op Fl 0DdHijkLlnOPtuvXYZ
81df930be7Sderaadt.Op Fl G Ar group
82d9bd2a6bSjaredy.Op Fl p Ar string
83d9bd2a6bSjaredy.Op Fl s Ar replstr
84d9bd2a6bSjaredy.Op Fl T Ar range
85d9bd2a6bSjaredy.Op Fl U Ar user
86679f6f8fSsobrado.Op Ar
87df930be7Sderaadt.Ar directory
88df930be7Sderaadt.Sh DESCRIPTION
89f11c8a18Saaron.Nm
90d9bd2a6bSjaredywill read, write, and list the members of an archive file
91df930be7Sderaadtand will copy directory hierarchies.
92f11c8a18Saaron.Nm
93d9bd2a6bSjaredyoperation is independent of the specific archive format
94df930be7Sderaadtand supports a wide variety of different archive formats.
95df930be7SderaadtA list of supported archive formats can be found under the description of the
96df930be7Sderaadt.Fl x
97df930be7Sderaadtoption.
98df930be7Sderaadt.Pp
99df930be7SderaadtThe presence of the
100df930be7Sderaadt.Fl r
101df930be7Sderaadtand the
102df930be7Sderaadt.Fl w
103df930be7Sderaadtoptions specifies which of the following functional modes
104f11c8a18Saaron.Nm
105df930be7Sderaadtwill operate under:
106df930be7Sderaadt.Em list , read , write ,
107df930be7Sderaadtand
108df930be7Sderaadt.Em copy .
109df930be7Sderaadt.Bl -tag -width 6n
110f3a5db6dSjmc.It Aq none
111df930be7Sderaadt.Em List .
112f11c8a18Saaron.Nm
113cdba0873Saaronwill write to standard output
114df930be7Sderaadta table of contents of the members of the archive file read from
115cdba0873Saaronstandard input, whose pathnames match the specified
116d9bd2a6bSjaredy.Ar pattern
117d9bd2a6bSjaredyarguments.
118df930be7SderaadtThe table of contents contains one filename per line
119df930be7Sderaadtand is written using single line buffering.
120df930be7Sderaadt.It Fl r
121df930be7Sderaadt.Em Read .
122f11c8a18Saaron.Nm
123cdba0873Saaronextracts the members of the archive file read from the standard input,
124df930be7Sderaadtwith pathnames matching the specified
125d9bd2a6bSjaredy.Ar pattern
126d9bd2a6bSjaredyarguments.
127df930be7SderaadtThe archive format and blocking is automatically determined on input.
128df930be7SderaadtWhen an extracted file is a directory, the entire file hierarchy
129df930be7Sderaadtrooted at that directory is extracted.
130df930be7SderaadtAll extracted files are created relative to the current file hierarchy.
131df930be7SderaadtThe setting of ownership, access and modification times, and file mode of
132df930be7Sderaadtthe extracted files are discussed in more detail under the
133df930be7Sderaadt.Fl p
134df930be7Sderaadtoption.
135df930be7Sderaadt.It Fl w
136df930be7Sderaadt.Em Write .
137f11c8a18Saaron.Nm
138df930be7Sderaadtwrites an archive containing the
139df930be7Sderaadt.Ar file
140cdba0873Saaronoperands to standard output
141df930be7Sderaadtusing the specified archive format.
142df930be7SderaadtWhen no
143df930be7Sderaadt.Ar file
144df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from
145cdba0873Saaronstandard input.
146df930be7SderaadtWhen a
147df930be7Sderaadt.Ar file
148df930be7Sderaadtoperand is also a directory, the entire file hierarchy rooted
149df930be7Sderaadtat that directory will be included.
150bb4196c7Sjmc.It Fl rw
151df930be7Sderaadt.Em Copy .
152f11c8a18Saaron.Nm
153df930be7Sderaadtcopies the
154df930be7Sderaadt.Ar file
155df930be7Sderaadtoperands to the destination
156df930be7Sderaadt.Ar directory .
157df930be7SderaadtWhen no
158df930be7Sderaadt.Ar file
159df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from
160cdba0873Saaronthe standard input.
161df930be7SderaadtWhen a
162df930be7Sderaadt.Ar file
163df930be7Sderaadtoperand is also a directory the entire file
164df930be7Sderaadthierarchy rooted at that directory will be included.
165df930be7SderaadtThe effect of the
166df930be7Sderaadt.Em copy
167df930be7Sderaadtis as if the copied files were written to an archive file and then
168df930be7Sderaadtsubsequently extracted, except that there may be hard links between
169df930be7Sderaadtthe original and the copied files (see the
170df930be7Sderaadt.Fl l
171df930be7Sderaadtoption below).
172df930be7Sderaadt.Pp
173d9bd2a6bSjaredy.Sy Warning :
174df930be7SderaadtThe destination
175df930be7Sderaadt.Ar directory
176df930be7Sderaadtmust not be one of the
177df930be7Sderaadt.Ar file
178df930be7Sderaadtoperands or a member of a file hierarchy rooted at one of the
179df930be7Sderaadt.Ar file
180df930be7Sderaadtoperands.
181df930be7SderaadtThe result of a
182df930be7Sderaadt.Em copy
183df930be7Sderaadtunder these conditions is unpredictable.
184df930be7Sderaadt.El
185df930be7Sderaadt.Pp
186f3a5db6dSjmcWhile processing a damaged archive during a read or list operation,
187f11c8a18Saaron.Nm
188df930be7Sderaadtwill attempt to recover from media defects and will search through the archive
189df930be7Sderaadtto locate and process the largest number of archive members possible (see the
190df930be7Sderaadt.Fl E
191df930be7Sderaadtoption for more details on error handling).
19238a123d1Saaron.Pp
193df930be7SderaadtThe
194df930be7Sderaadt.Ar directory
195df930be7Sderaadtoperand specifies a destination directory pathname.
196df930be7SderaadtIf the
197df930be7Sderaadt.Ar directory
198df930be7Sderaadtoperand does not exist, or it is not writable by the user,
199df930be7Sderaadtor it is not of type directory,
200f11c8a18Saaron.Nm
201df930be7Sderaadtwill exit with a non-zero exit status.
202df930be7Sderaadt.Pp
203df930be7SderaadtThe
204df930be7Sderaadt.Ar pattern
205df930be7Sderaadtoperand is used to select one or more pathnames of archive members.
206df930be7SderaadtArchive members are selected using the pattern matching notation described
207df930be7Sderaadtby
208d9bd2a6bSjaredy.Xr glob 3 .
209df930be7SderaadtWhen the
210df930be7Sderaadt.Ar pattern
211df930be7Sderaadtoperand is not supplied, all members of the archive will be selected.
212df930be7SderaadtWhen a
213df930be7Sderaadt.Ar pattern
214df930be7Sderaadtmatches a directory, the entire file hierarchy rooted at that directory will
215df930be7Sderaadtbe selected.
216df930be7SderaadtWhen a
217df930be7Sderaadt.Ar pattern
218df930be7Sderaadtoperand does not select at least one archive member,
219f11c8a18Saaron.Nm
220df930be7Sderaadtwill write these
221df930be7Sderaadt.Ar pattern
2226339491eSjmcoperands in a diagnostic message to standard error
223df930be7Sderaadtand then exit with a non-zero exit status.
224df930be7Sderaadt.Pp
225df930be7SderaadtThe
226df930be7Sderaadt.Ar file
227df930be7Sderaadtoperand specifies the pathname of a file to be copied or archived.
228df930be7SderaadtWhen a
229df930be7Sderaadt.Ar file
230df930be7Sderaadtoperand does not select at least one archive member,
231f11c8a18Saaron.Nm
232df930be7Sderaadtwill write these
233df930be7Sderaadt.Ar file
234cdba0873Saaronoperand pathnames in a diagnostic message to standard error
235df930be7Sderaadtand then exit with a non-zero exit status.
23638a123d1Saaron.Pp
2378cf461a5SaaronThe options are as follows:
238f1ba3473Saaron.Bl -tag -width Ds
239e70d39b4Sjaredy.It Fl 0
240e70d39b4SjaredyUse the NUL
241e70d39b4Sjaredy.Pq Ql \e0
242e70d39b4Sjaredycharacter as a pathname terminator, instead of newline
243e70d39b4Sjaredy.Pq Ql \en .
244e70d39b4SjaredyThis applies only to the pathnames read from standard input in
245e70d39b4Sjaredythe write and copy modes,
246e70d39b4Sjaredyand to the pathnames written to standard output in list mode.
247e70d39b4SjaredyThis option is expected to be used in concert with the
248e70d39b4Sjaredy.Fl print0
249e70d39b4Sjaredyfunction in
250e70d39b4Sjaredy.Xr find 1
251e70d39b4Sjaredyor the
252e70d39b4Sjaredy.Fl 0
253e70d39b4Sjaredyflag in
254e70d39b4Sjaredy.Xr xargs 1 .
255df930be7Sderaadt.It Fl a
256d9bd2a6bSjaredyAppend the given
257d9bd2a6bSjaredy.Ar file
258d9bd2a6bSjaredyoperands
259df930be7Sderaadtto the end of an archive that was previously written.
260df930be7SderaadtIf an archive format is not specified with a
261df930be7Sderaadt.Fl x
262df930be7Sderaadtoption, the format currently being used in the archive will be selected.
263df930be7SderaadtAny attempt to append to an archive in a format different from the
264df930be7Sderaadtformat already used in the archive will cause
265f11c8a18Saaron.Nm
266df930be7Sderaadtto exit immediately
267df930be7Sderaadtwith a non-zero exit status.
268df930be7SderaadtThe blocking size used in the archive volume where writing starts
269df930be7Sderaadtwill continue to be used for the remainder of that archive volume.
270df930be7Sderaadt.Pp
271d9bd2a6bSjaredy.Sy Warning :
272df930be7SderaadtMany storage devices are not able to support the operations necessary
273df930be7Sderaadtto perform an append operation.
274df930be7SderaadtAny attempt to append to an archive stored on such a device may damage the
275df930be7Sderaadtarchive or have other unpredictable results.
276df930be7SderaadtTape drives in particular are more likely to not support an append operation.
277df930be7SderaadtAn archive stored in a regular file system file or on a disk device will
278df930be7Sderaadtusually support an append operation.
279e70d39b4Sjaredy.It Fl B Ar bytes
280e70d39b4SjaredyLimit the number of bytes written to a single archive volume to
281e70d39b4Sjaredy.Ar bytes .
282e70d39b4SjaredyThe
283e70d39b4Sjaredy.Ar bytes
284e70d39b4Sjaredylimit can end with
285e70d39b4Sjaredy.Sq Li m ,
286e70d39b4Sjaredy.Sq Li k ,
287e70d39b4Sjaredyor
288e70d39b4Sjaredy.Sq Li b
289e70d39b4Sjaredyto specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
290e70d39b4SjaredyA pair of
291e70d39b4Sjaredy.Ar bytes
292e70d39b4Sjaredylimits can be separated by
293e70d39b4Sjaredy.Sq Li x
294e70d39b4Sjaredyto indicate a product.
295e70d39b4Sjaredy.Pp
296f3a5db6dSjmc.Sy Warning :
297e70d39b4SjaredyOnly use this option when writing an archive to a device which supports
298e70d39b4Sjaredyan end of file read condition based on last (or largest) write offset
299e70d39b4Sjaredy(such as a regular file or a tape drive).
300e70d39b4SjaredyThe use of this option with a floppy or hard disk is not recommended.
301df930be7Sderaadt.It Fl b Ar blocksize
302f3a5db6dSjmcWhen writing an archive,
303df930be7Sderaadtblock the output at a positive decimal integer number of
304df930be7Sderaadtbytes per write to the archive file.
305df930be7SderaadtThe
306df930be7Sderaadt.Ar blocksize
307ea4b1a1aSmillertmust be a multiple of 512 bytes with a maximum of 64512 bytes.
30812bc6069SschwarzeArchive block sizes larger than 32256 bytes violate the POSIX
309ea4b1a1aSmillertstandard and will not be portable to all systems.
310df930be7SderaadtA
311df930be7Sderaadt.Ar blocksize
312df930be7Sderaadtcan end with
313f81d96dfSaaron.Sq Li k
314df930be7Sderaadtor
315f81d96dfSaaron.Sq Li b
316df930be7Sderaadtto specify multiplication by 1024 (1K) or 512, respectively.
317f3a5db6dSjmcA pair of blocksizes can be separated by
318f81d96dfSaaron.Sq Li x
319df930be7Sderaadtto indicate a product.
320df930be7SderaadtA specific archive device may impose additional restrictions on the size
321df930be7Sderaadtof blocking it will support.
322df930be7SderaadtWhen blocking is not specified, the default
323df930be7Sderaadt.Ar blocksize
324df930be7Sderaadtis dependent on the specific archive format being used (see the
325df930be7Sderaadt.Fl x
326df930be7Sderaadtoption).
327df930be7Sderaadt.It Fl c
328df930be7SderaadtMatch all file or archive members
329df930be7Sderaadt.Em except
330df930be7Sderaadtthose specified by the
331df930be7Sderaadt.Ar pattern
332df930be7Sderaadtand
333df930be7Sderaadt.Ar file
334df930be7Sderaadtoperands.
335e70d39b4Sjaredy.It Fl D
336e70d39b4SjaredyThis option is the same as the
337e70d39b4Sjaredy.Fl u
338e70d39b4Sjaredyoption, except that the file inode change time is checked instead of the
339e70d39b4Sjaredyfile modification time.
340e70d39b4SjaredyThe file inode change time can be used to select files whose inode information
341e70d39b4Sjaredy(e.g., UID, GID, etc.) is newer than a copy of the file in the destination
342e70d39b4Sjaredy.Ar directory .
343df930be7Sderaadt.It Fl d
344df930be7SderaadtCause files of type directory being copied or archived, or archive members of
345df930be7Sderaadttype directory being extracted, to match only the directory file or archive
346df930be7Sderaadtmember and not the file hierarchy rooted at the directory.
347e70d39b4Sjaredy.It Fl E Ar limit
348e70d39b4SjaredyLimit the number of consecutive read faults while trying to read a flawed
349e70d39b4Sjaredyarchive to
350e70d39b4Sjaredy.Ar limit .
351e70d39b4SjaredyWith a positive
352e70d39b4Sjaredy.Ar limit ,
353e70d39b4Sjaredy.Nm
354e70d39b4Sjaredywill attempt to recover from an archive read error and will
355e70d39b4Sjaredycontinue processing starting with the next file stored in the archive.
356e70d39b4SjaredyA
357e70d39b4Sjaredy.Ar limit
358e70d39b4Sjaredyof 0 will cause
359e70d39b4Sjaredy.Nm
360e70d39b4Sjaredyto stop operation after the first read error is detected on an archive volume.
361e70d39b4SjaredyA
362e70d39b4Sjaredy.Ar limit
363e70d39b4Sjaredyof
364e70d39b4Sjaredy.Li NONE
365e70d39b4Sjaredywill cause
366e70d39b4Sjaredy.Nm
367e70d39b4Sjaredyto attempt to recover from read errors forever.
368e70d39b4SjaredyThe default
369e70d39b4Sjaredy.Ar limit
370e70d39b4Sjaredyis a small positive number of retries.
371e70d39b4Sjaredy.Pp
372f3a5db6dSjmc.Sy Warning :
373e70d39b4SjaredyUsing this option with
374e70d39b4Sjaredy.Li NONE
375e70d39b4Sjaredyshould be used with extreme caution as
376e70d39b4Sjaredy.Nm
377e70d39b4Sjaredymay get stuck in an infinite loop on a very badly flawed archive.
378df930be7Sderaadt.It Fl f Ar archive
379df930be7SderaadtSpecify
380df930be7Sderaadt.Ar archive
381df930be7Sderaadtas the pathname of the input or output archive, overriding the default
382f3a5db6dSjmcstandard input (for list and read)
383cdba0873Saaronor standard output
384f3a5db6dSjmc(for write).
385df930be7SderaadtA single archive may span multiple files and different archive devices.
386df930be7SderaadtWhen required,
387f11c8a18Saaron.Nm
388df930be7Sderaadtwill prompt for the pathname of the file or device of the next volume in the
389df930be7Sderaadtarchive.
390e70d39b4Sjaredy.It Fl G Ar group
391e70d39b4SjaredySelect a file based on its
392e70d39b4Sjaredy.Ar group
393e70d39b4Sjaredyname, or when starting with a
394e70d39b4Sjaredy.Cm # ,
395e70d39b4Sjaredya numeric GID.
396e70d39b4SjaredyA
397e70d39b4Sjaredy.Ql \e
398e70d39b4Sjaredycan be used to escape the
399e70d39b4Sjaredy.Cm # .
400e70d39b4SjaredyMultiple
401e70d39b4Sjaredy.Fl G
402e70d39b4Sjaredyoptions may be supplied and checking stops with the first match.
403e70d39b4Sjaredy.It Fl H
404e70d39b4SjaredyFollow only command-line symbolic links while performing a physical file
405e70d39b4Sjaredysystem traversal.
406df930be7Sderaadt.It Fl i
407df930be7SderaadtInteractively rename files or archive members.
408df930be7SderaadtFor each archive member matching a
409df930be7Sderaadt.Ar pattern
410df930be7Sderaadtoperand or each file matching a
411df930be7Sderaadt.Ar file
412df930be7Sderaadtoperand,
413f11c8a18Saaron.Nm
414df930be7Sderaadtwill prompt to
415df930be7Sderaadt.Pa /dev/tty
4161fd45b44Saarongiving the name of the file, its file mode, and its modification time.
417f11c8a18Saaron.Nm
418df930be7Sderaadtwill then read a line from
419df930be7Sderaadt.Pa /dev/tty .
420df930be7SderaadtIf this line is blank, the file or archive member is skipped.
421df930be7SderaadtIf this line consists of a single period, the
422df930be7Sderaadtfile or archive member is processed with no modification to its name.
423df930be7SderaadtOtherwise, its name is replaced with the contents of the line.
424f11c8a18Saaron.Nm
425df930be7Sderaadtwill immediately exit with a non-zero exit status if
426cdba0873Saaron.Dv EOF
427df930be7Sderaadtis encountered when reading a response or if
428df930be7Sderaadt.Pa /dev/tty
429df930be7Sderaadtcannot be opened for reading and writing.
430a914b46dSpvalchev.It Fl j
431a914b46dSpvalchevUse bzip2 to compress (decompress) the archive while writing (reading).
432a914b46dSpvalchevThe bzip2 utility must be installed separately.
433a914b46dSpvalchevIncompatible with
434a914b46dSpvalchev.Fl a .
435df930be7Sderaadt.It Fl k
436df930be7SderaadtDo not overwrite existing files.
437e70d39b4Sjaredy.It Fl L
438e70d39b4SjaredyFollow all symbolic links to perform a logical file system traversal.
439df930be7Sderaadt.It Fl l
440b3119326Saaron(The lowercase letter
4410cd08285Sjmc.Dq ell . )
442b3119326SaaronLink files.
443f3a5db6dSjmcIn copy mode
444f81d96dfSaaron.Pq Fl r Fl w ,
445df930be7Sderaadthard links are made between the source and destination file hierarchies
446df930be7Sderaadtwhenever possible.
447df930be7Sderaadt.It Fl n
448df930be7SderaadtSelect the first archive member that matches each
449df930be7Sderaadt.Ar pattern
450df930be7Sderaadtoperand.
451df930be7SderaadtNo more than one archive member is matched for each
452df930be7Sderaadt.Ar pattern .
453df930be7SderaadtWhen members of type directory are matched, the file hierarchy rooted at that
454df930be7Sderaadtdirectory is also matched (unless
455df930be7Sderaadt.Fl d
456df930be7Sderaadtis also specified).
457e70d39b4Sjaredy.It Fl O
458e70d39b4SjaredyForce the archive to be one volume.
459e70d39b4SjaredyIf a volume ends prematurely,
460e70d39b4Sjaredy.Nm
461e70d39b4Sjaredywill not prompt for a new volume.
462e70d39b4SjaredyThis option can be useful for
463e70d39b4Sjaredyautomated tasks where error recovery cannot be performed by a human.
464df930be7Sderaadt.It Fl o Ar options
465df930be7SderaadtInformation to modify the algorithm for extracting or writing archive files
466df930be7Sderaadtwhich is specific to the archive format specified by
467df930be7Sderaadt.Fl x .
468df930be7SderaadtIn general,
469df930be7Sderaadt.Ar options
470df930be7Sderaadttake the form:
471d741230eSjmc.Ar name Ns = Ns Ar value .
472d9bd2a6bSjaredy.Pp
473403f1672SzhukThe following options are available for the
474f3a5db6dSjmc.Cm ustar
475403f1672Szhukand old
476d9bd2a6bSjaredy.Bx
477f3a5db6dSjmc.Cm tar
478403f1672Szhukformats:
479d9bd2a6bSjaredy.Pp
480d9bd2a6bSjaredy.Bl -tag -width Ds -compact
481d9bd2a6bSjaredy.It Cm write_opt=nodir
482d9bd2a6bSjaredyWhen writing archives, omit the storage of directories.
483d9bd2a6bSjaredy.El
484e70d39b4Sjaredy.It Fl P
485e70d39b4SjaredyDo not follow symbolic links, perform a physical file system traversal.
486e70d39b4SjaredyThis is the default mode.
487df930be7Sderaadt.It Fl p Ar string
488df930be7SderaadtSpecify one or more file characteristic options (privileges).
489df930be7SderaadtThe
490df930be7Sderaadt.Ar string
491df930be7Sderaadtoption-argument is a string specifying file characteristics to be retained or
492df930be7Sderaadtdiscarded on extraction.
493df930be7SderaadtThe string consists of the specification characters
494df930be7Sderaadt.Cm a , e , m , o ,
495df930be7Sderaadtand
496df930be7Sderaadt.Cm p .
497df930be7SderaadtMultiple characteristics can be concatenated within the same string
498df930be7Sderaadtand multiple
499df930be7Sderaadt.Fl p
500df930be7Sderaadtoptions can be specified.
501ff488c0dSjmcThe meanings of the specification characters are as follows:
502df930be7Sderaadt.Bl -tag -width 2n
503df930be7Sderaadt.It Cm a
504df930be7SderaadtDo not preserve file access times.
505df930be7SderaadtBy default, file access times are preserved whenever possible.
506df930be7Sderaadt.It Cm e
507d9bd2a6bSjaredy.Dq Preserve everything ,
508df930be7Sderaadtthe user ID, group ID, file mode bits,
509df930be7Sderaadtfile access time, and file modification time.
510f3a5db6dSjmcThis is intended to be used by root,
511df930be7Sderaadtsomeone with all the appropriate privileges, in order to preserve all
512df930be7Sderaadtaspects of the files as they are recorded in the archive.
513df930be7SderaadtThe
514df930be7Sderaadt.Cm e
515df930be7Sderaadtflag is the sum of the
516df930be7Sderaadt.Cm o
517df930be7Sderaadtand
518df930be7Sderaadt.Cm p
519df930be7Sderaadtflags.
520df930be7Sderaadt.It Cm m
521df930be7SderaadtDo not preserve file modification times.
522df930be7SderaadtBy default, file modification times are preserved whenever possible.
523df930be7Sderaadt.It Cm o
524df930be7SderaadtPreserve the user ID and group ID.
525df930be7Sderaadt.It Cm p
526d9bd2a6bSjaredy.Dq Preserve
527df930be7Sderaadtthe file mode bits.
528f3a5db6dSjmcThis is intended to be used by a user with regular privileges
529f3a5db6dSjmcwho wants to preserve all aspects of the file other than the ownership.
530df930be7SderaadtThe file times are preserved by default, but two other flags are offered to
531df930be7Sderaadtdisable this and use the time of extraction instead.
532df930be7Sderaadt.El
533df930be7Sderaadt.Pp
534df930be7SderaadtIn the preceding list,
535df930be7Sderaadt.Sq preserve
536df930be7Sderaadtindicates that an attribute stored in the archive is given to the
537df930be7Sderaadtextracted file, subject to the permissions of the invoking
538df930be7Sderaadtprocess.
539df930be7SderaadtOtherwise the attribute of the extracted file is determined as
540df930be7Sderaadtpart of the normal file creation action.
541df930be7SderaadtIf neither the
542df930be7Sderaadt.Cm e
543df930be7Sderaadtnor the
544df930be7Sderaadt.Cm o
545df930be7Sderaadtspecification character is specified, or the user ID and group ID are not
546df930be7Sderaadtpreserved for any reason,
547f11c8a18Saaron.Nm
548df930be7Sderaadtwill not set the
549df930be7Sderaadt.Dv S_ISUID
550f3a5db6dSjmc(setuid) and
551df930be7Sderaadt.Dv S_ISGID
552f3a5db6dSjmc(setgid) bits of the file mode.
553df930be7SderaadtIf the preservation of any of these items fails for any reason,
554f11c8a18Saaron.Nm
555cdba0873Saaronwill write a diagnostic message to standard error.
556df930be7SderaadtFailure to preserve these items will affect the final exit status,
557df930be7Sderaadtbut will not cause the extracted file to be deleted.
558df930be7SderaadtIf the file characteristic letters in any of the string option-arguments are
559df930be7Sderaadtduplicated or conflict with each other, the one(s) given last will take
560df930be7Sderaadtprecedence.
561df930be7SderaadtFor example, if
562d9bd2a6bSjaredy.Fl p Ar eme
563df930be7Sderaadtis specified, file modification times are still preserved.
564e70d39b4Sjaredy.It Fl r
565e70d39b4SjaredyRead an archive file from standard input
566e70d39b4Sjaredyand extract the specified
567e70d39b4Sjaredy.Ar file
568e70d39b4Sjaredyoperands.
569e70d39b4SjaredyIf any intermediate directories are needed in order to extract an archive
570e70d39b4Sjaredymember, these directories will be created as if
571e70d39b4Sjaredy.Xr mkdir 2
5723fe753f8Sguentherwas called with the bitwise OR of
573e70d39b4Sjaredy.Dv S_IRWXU , S_IRWXG ,
574e70d39b4Sjaredyand
575e70d39b4Sjaredy.Dv S_IRWXO
576e70d39b4Sjaredyas the mode argument.
577e70d39b4SjaredyWhen the selected archive format supports the specification of linked
578e70d39b4Sjaredyfiles and these files cannot be linked while the archive is being extracted,
579e70d39b4Sjaredy.Nm
580e70d39b4Sjaredywill write a diagnostic message to standard error
581e70d39b4Sjaredyand exit with a non-zero exit status at the completion of operation.
582df930be7Sderaadt.It Fl s Ar replstr
583d9bd2a6bSjaredyModify the archive member names according to the substitution expression
584df930be7Sderaadt.Ar replstr ,
585df930be7Sderaadtusing the syntax of the
586df930be7Sderaadt.Xr ed 1
587df930be7Sderaadtutility regular expressions.
588d9bd2a6bSjaredy.Ar file
589d9bd2a6bSjaredyor
590d9bd2a6bSjaredy.Ar pattern
591d9bd2a6bSjaredyarguments may be given to restrict the list of archive members to those
592d9bd2a6bSjaredyspecified.
593d9bd2a6bSjaredy.Pp
594ff488c0dSjmcThe format of these regular expressions is:
595d9bd2a6bSjaredy.Pp
596df930be7Sderaadt.Dl /old/new/[gp]
597d9bd2a6bSjaredy.Pp
598df930be7SderaadtAs in
599df930be7Sderaadt.Xr ed 1 ,
600d9bd2a6bSjaredy.Ar old
601d9bd2a6bSjaredyis a basic regular expression (see
602d9bd2a6bSjaredy.Xr re_format 7 )
603d9bd2a6bSjaredyand
604d9bd2a6bSjaredy.Ar new
605cdba0873Saaroncan contain an ampersand
606cdba0873Saaron.Pq Ql & ,
607d9bd2a6bSjaredy.Ql \e Ns Em n
608cdba0873Saaron(where
609d9bd2a6bSjaredy.Em n
610cdba0873Saaronis a digit) back-references,
611df930be7Sderaadtor subexpression matching.
612df930be7SderaadtThe
613d9bd2a6bSjaredy.Ar old
614cdba0873Saaronstring may also contain newline characters.
615cdba0873SaaronAny non-null character can be used as a delimiter
616cdba0873Saaron.Po
617cdba0873Saaron.Ql /
618cdba0873Saaronis shown here
619cdba0873Saaron.Pc .
620df930be7SderaadtMultiple
621df930be7Sderaadt.Fl s
622df930be7Sderaadtexpressions can be specified.
623df930be7SderaadtThe expressions are applied in the order they are specified on the
624df930be7Sderaadtcommand line, terminating with the first successful substitution.
625d9bd2a6bSjaredy.Pp
626df930be7SderaadtThe optional trailing
627df930be7Sderaadt.Cm g
628ff488c0dSjmccontinues to apply the substitution expression to the pathname substring,
629df930be7Sderaadtwhich starts with the first character following the end of the last successful
6308c926583Saaronsubstitution.
6318c926583SaaronThe first unsuccessful substitution stops the operation of the
632df930be7Sderaadt.Cm g
633df930be7Sderaadtoption.
634df930be7SderaadtThe optional trailing
635df930be7Sderaadt.Cm p
636df930be7Sderaadtwill cause the final result of a successful substitution to be written to
637cdba0873Saaronstandard error in the following format:
638d9bd2a6bSjaredy.Pp
639f3a5db6dSjmc.D1 Em original-pathname No >> Em new-pathname
640d9bd2a6bSjaredy.Pp
641df930be7SderaadtFile or archive member names that substitute to the empty string
642df930be7Sderaadtare not selected and will be skipped.
643e70d39b4Sjaredy.It Fl T Ar range
644e70d39b4SjaredyAllow files to be selected based on a file modification or inode change
645e70d39b4Sjaredytime falling within the specified time range.
646e70d39b4SjaredyThe range has the format:
647e70d39b4Sjaredy.Sm off
648e70d39b4Sjaredy.Bd -filled -offset indent
649e593fc94Sjmc.Op Ar from_date
650e593fc94Sjmc.Op \&, Ar to_date
651e593fc94Sjmc.Op / Oo Cm c Oc Op Cm m
652e70d39b4Sjaredy.Ed
653e70d39b4Sjaredy.Sm on
654e70d39b4Sjaredy.Pp
655e70d39b4SjaredyThe dates specified by
656e70d39b4Sjaredy.Ar from_date
657e70d39b4Sjaredyto
658e70d39b4Sjaredy.Ar to_date
659e70d39b4Sjaredyare inclusive.
660e70d39b4SjaredyIf only a
661e70d39b4Sjaredy.Ar from_date
662e70d39b4Sjaredyis supplied, all files with a modification or inode change time
663e70d39b4Sjaredyequal to or younger are selected.
664e70d39b4SjaredyIf only a
665e70d39b4Sjaredy.Ar to_date
666e70d39b4Sjaredyis supplied, all files with a modification or inode change time
667e70d39b4Sjaredyequal to or older will be selected.
668e70d39b4SjaredyWhen the
669e70d39b4Sjaredy.Ar from_date
670e70d39b4Sjaredyis equal to the
671e70d39b4Sjaredy.Ar to_date ,
672e70d39b4Sjaredyonly files with a modification or inode change time of exactly that
673e70d39b4Sjaredytime will be selected.
674e70d39b4Sjaredy.Pp
675e70d39b4SjaredyWhen
676e70d39b4Sjaredy.Nm
677f3a5db6dSjmcis in write or copy mode, the optional trailing field
678e593fc94Sjmc.Oo Cm c Oc Ns Op Cm m
679e70d39b4Sjaredycan be used to determine which file time (inode change, file modification or
680e70d39b4Sjaredyboth) are used in the comparison.
681e70d39b4SjaredyIf neither is specified, the default is to use file modification time only.
682e70d39b4SjaredyThe
683e70d39b4Sjaredy.Cm m
684e70d39b4Sjaredyspecifies the comparison of file modification time (the time when
685e70d39b4Sjaredythe file was last written).
686e70d39b4SjaredyThe
687e70d39b4Sjaredy.Cm c
688e70d39b4Sjaredyspecifies the comparison of inode change time (the time when the file
689e70d39b4Sjaredyinode was last changed; e.g., a change of owner, group, mode, etc).
690e70d39b4SjaredyWhen
691e70d39b4Sjaredy.Cm c
692e70d39b4Sjaredyand
693e70d39b4Sjaredy.Cm m
694e70d39b4Sjaredyare both specified, then the modification and inode change times are
695e70d39b4Sjaredyboth compared.
696e70d39b4Sjaredy.Pp
697e70d39b4SjaredyThe inode change time comparison is useful in selecting files whose
698e70d39b4Sjaredyattributes were recently changed or selecting files which were recently
699e70d39b4Sjaredycreated and had their modification time reset to an older time (as what
700e70d39b4Sjaredyhappens when a file is extracted from an archive and the modification time
701e70d39b4Sjaredyis preserved).
702e70d39b4SjaredyTime comparisons using both file times is useful when
703e70d39b4Sjaredy.Nm
704e70d39b4Sjaredyis used to create a time based incremental archive (only files that were
705e70d39b4Sjaredychanged during a specified time range will be archived).
706e70d39b4Sjaredy.Pp
707e70d39b4SjaredyA time range is made up of six different fields and each field must contain two
708e70d39b4Sjaredydigits.
709e70d39b4SjaredyThe format is:
710e70d39b4Sjaredy.Pp
711e70d39b4Sjaredy.Dl [[[[[cc]yy]mm]dd]HH]MM[.SS]
712e70d39b4Sjaredy.Pp
713e70d39b4SjaredyWhere
714e70d39b4Sjaredy.Ar cc
715e70d39b4Sjaredyis the first two digits of the year (the century),
716e70d39b4Sjaredy.Ar yy
717e70d39b4Sjaredyis the last two digits of the year,
718e70d39b4Sjaredythe first
719e70d39b4Sjaredy.Ar mm
720e70d39b4Sjaredyis the month (from 01 to 12),
721e70d39b4Sjaredy.Ar dd
722e70d39b4Sjaredyis the day of the month (from 01 to 31),
723e70d39b4Sjaredy.Ar HH
724e70d39b4Sjaredyis the hour of the day (from 00 to 23),
725e70d39b4Sjaredy.Ar MM
726e70d39b4Sjaredyis the minute (from 00 to 59),
727e70d39b4Sjaredyand
728e70d39b4Sjaredy.Ar SS
729e70d39b4Sjaredyis the seconds (from 00 to 59).
730e70d39b4SjaredyThe minute field
731e70d39b4Sjaredy.Ar MM
732e70d39b4Sjaredyis required, while the other fields are optional and must be added in the
733e70d39b4Sjaredyfollowing order:
734e70d39b4Sjaredy.Ar HH , dd , mm ,
735e70d39b4Sjaredy.Ar yy , cc .
736e70d39b4Sjaredy.Pp
737e70d39b4SjaredyThe
738e70d39b4Sjaredy.Ar SS
739e70d39b4Sjaredyfield may be added independently of the other fields.
740e70d39b4SjaredyTime ranges are relative to the current time, so
741e70d39b4Sjaredy.Ic -T 1234/cm
742e70d39b4Sjaredywould select all files with a modification or inode change time
743e70d39b4Sjaredyof 12:34 PM today or later.
744e70d39b4SjaredyMultiple
745e70d39b4Sjaredy.Fl T
746e70d39b4Sjaredytime range can be supplied and checking stops with the first match.
747df930be7Sderaadt.It Fl t
748df930be7SderaadtReset the access times of any file or directory read or accessed by
749f11c8a18Saaron.Nm
750df930be7Sderaadtto be the same as they were before being read or accessed by
751df930be7Sderaadt.Nm pax .
752e70d39b4Sjaredy.It Fl U Ar user
753e70d39b4SjaredySelect a file based on its
754e70d39b4Sjaredy.Ar user
755e70d39b4Sjaredyname, or when starting with a
756e70d39b4Sjaredy.Cm # ,
757e70d39b4Sjaredya numeric UID.
758e70d39b4SjaredyA
759e70d39b4Sjaredy.Ql \e
760e70d39b4Sjaredycan be used to escape the
761e70d39b4Sjaredy.Cm # .
762e70d39b4SjaredyMultiple
763e70d39b4Sjaredy.Fl U
764e70d39b4Sjaredyoptions may be supplied and checking stops with the first match.
765df930be7Sderaadt.It Fl u
766df930be7SderaadtIgnore files that are older (having a less recent file modification time)
767df930be7Sderaadtthan a pre-existing file or archive member with the same name.
768f3a5db6dSjmcDuring read,
769df930be7Sderaadtan archive member with the same name as a file in the file system will be
770df930be7Sderaadtextracted if the archive member is newer than the file.
771f3a5db6dSjmcDuring write,
772df930be7Sderaadta file system member with the same name as an archive member will be
773df930be7Sderaadtwritten to the archive if it is newer than the archive member.
774f3a5db6dSjmcDuring copy,
775df930be7Sderaadtthe file in the destination hierarchy is replaced by the file in the source
776df930be7Sderaadthierarchy or by a link to the file in the source hierarchy if the file in
777df930be7Sderaadtthe source hierarchy is newer.
778df930be7Sderaadt.It Fl v
779f3a5db6dSjmcDuring a list operation, produce a verbose table of contents using the format of the
780df930be7Sderaadt.Xr ls 1
781df930be7Sderaadtutility with the
782df930be7Sderaadt.Fl l
783df930be7Sderaadtoption.
784df930be7SderaadtFor pathnames representing a hard link to a previous member of the archive,
785df930be7Sderaadtthe output has the format:
786d9bd2a6bSjaredy.Pp
787f3a5db6dSjmc.Dl Em ls -l listing No == Em link-name
788d9bd2a6bSjaredy.Pp
789df930be7SderaadtFor pathnames representing a symbolic link, the output has the format:
790d9bd2a6bSjaredy.Pp
791f3a5db6dSjmc.Dl Em ls -l listing No -> Em link-name
792d9bd2a6bSjaredy.Pp
793d9bd2a6bSjaredyWhere
794d9bd2a6bSjaredy.Em ls -l listing
795d9bd2a6bSjaredyis the output format specified by the
796df930be7Sderaadt.Xr ls 1
797df930be7Sderaadtutility when used with the
798df930be7Sderaadt.Fl l
799df930be7Sderaadtoption.
800f81d96dfSaaronOtherwise for all the other operational modes
801f3a5db6dSjmc(read, write, and copy),
802cdba0873Saaronpathnames are written and flushed to standard error
803cdba0873Saaronwithout a trailing newline
804df930be7Sderaadtas soon as processing begins on that file or
805df930be7Sderaadtarchive member.
806cdba0873SaaronThe trailing newline
807cdba0873Saaronis not buffered and is written only after the file has been read or written.
808e70d39b4Sjaredy.It Fl w
809e70d39b4SjaredyWrite files to the standard output
810e70d39b4Sjaredyin the specified archive format.
811e70d39b4SjaredyWhen no
812e70d39b4Sjaredy.Ar file
813e70d39b4Sjaredyoperands are specified, standard input
814e70d39b4Sjaredyis read for a list of pathnames with one per line without any leading or
815e70d39b4Sjaredytrailing
816e70d39b4Sjaredy.Aq blanks .
817e70d39b4Sjaredy.It Fl X
818e70d39b4SjaredyWhen traversing the file hierarchy specified by a pathname,
819e70d39b4Sjaredydo not descend into directories that have a different device ID.
820e70d39b4SjaredySee the
821e70d39b4Sjaredy.Li st_dev
822e70d39b4Sjaredyfield as described in
823e70d39b4Sjaredy.Xr stat 2
824e70d39b4Sjaredyfor more information about device IDs.
825df930be7Sderaadt.It Fl x Ar format
826df930be7SderaadtSpecify the output archive format, with the default format being
827d9bd2a6bSjaredy.Cm ustar .
828f11c8a18Saaron.Nm
829df930be7Sderaadtcurrently supports the following formats:
830df930be7Sderaadt.Bl -tag -width "sv4cpio"
831d9bd2a6bSjaredy.It Cm bcpio
832df930be7SderaadtThe old binary cpio format.
833df930be7SderaadtThe default blocksize for this format is 5120 bytes.
834df930be7SderaadtThis format is not very portable and should not be used when other formats
835df930be7Sderaadtare available.
836df930be7SderaadtInode and device information about a file (used for detecting file hard links
837ff488c0dSjmcby this format), which may be truncated by this format, is detected by
838f11c8a18Saaron.Nm
839df930be7Sderaadtand is repaired.
840bb4196c7Sjmc.It Cm cpio
841bb4196c7SjmcThe extended cpio interchange format specified in the
842bb4196c7Sjmc.St -p1003.2
843bb4196c7Sjmcstandard.
844bb4196c7SjmcThe default blocksize for this format is 5120 bytes.
845bb4196c7SjmcInode and device information about a file (used for detecting file hard links
846bb4196c7Sjmcby this format), which may be truncated by this format, is detected by
847bb4196c7Sjmc.Nm
848bb4196c7Sjmcand is repaired.
849d9bd2a6bSjaredy.It Cm sv4cpio
850df930be7SderaadtThe System V release 4 cpio.
851df930be7SderaadtThe default blocksize for this format is 5120 bytes.
852df930be7SderaadtInode and device information about a file (used for detecting file hard links
853ff488c0dSjmcby this format), which may be truncated by this format, is detected by
854f11c8a18Saaron.Nm
855df930be7Sderaadtand is repaired.
856d9bd2a6bSjaredy.It Cm sv4crc
857d9bd2a6bSjaredyThe System V release 4 cpio with file CRC checksums.
858df930be7SderaadtThe default blocksize for this format is 5120 bytes.
859df930be7SderaadtInode and device information about a file (used for detecting file hard links
860ff488c0dSjmcby this format), which may be truncated by this format, is detected by
861f11c8a18Saaron.Nm
862df930be7Sderaadtand is repaired.
863d9bd2a6bSjaredy.It Cm tar
864d9bd2a6bSjaredyThe old
865d9bd2a6bSjaredy.Bx
866d9bd2a6bSjaredytar format as found in
867d9bd2a6bSjaredy.Bx 4.3 .
868df930be7SderaadtThe default blocksize for this format is 10240 bytes.
869df930be7SderaadtPathnames stored by this format must be 100 characters or less in length.
870f3a5db6dSjmcOnly regular files, hard links, soft links, and directories
871df930be7Sderaadtwill be archived (other file system types are not supported).
872df930be7SderaadtFor backwards compatibility with even older tar formats, a
873df930be7Sderaadt.Fl o
874df930be7Sderaadtoption can be used when writing an archive to omit the storage of directories.
875df930be7SderaadtThis option takes the form:
876d9bd2a6bSjaredy.Pp
877df930be7Sderaadt.Dl Fl o Cm write_opt=nodir
878d9bd2a6bSjaredy.It Cm ustar
879df930be7SderaadtThe extended tar interchange format specified in the
880df930be7Sderaadt.St -p1003.2
881df930be7Sderaadtstandard.
882df930be7SderaadtThe default blocksize for this format is 10240 bytes.
883c1aa369bSjmcFilenames stored by this format must be 100 characters or less in length;
884feb8f2d5Smartynasthe total pathname must be 256 characters or less.
885df930be7Sderaadt.El
886df930be7Sderaadt.Pp
887f11c8a18Saaron.Nm
888df930be7Sderaadtwill detect and report any file that it is unable to store or extract
889df930be7Sderaadtas the result of any specific archive format restrictions.
890df930be7SderaadtThe individual archive formats may impose additional restrictions on use.
891df930be7SderaadtTypical archive format restrictions include (but are not limited to):
892f81d96dfSaaronfile pathname length, file size, link pathname length, and the type of the
893f81d96dfSaaronfile.
894df930be7Sderaadt.It Fl Y
895df930be7SderaadtThis option is the same as the
896df930be7Sderaadt.Fl D
897df930be7Sderaadtoption, except that the inode change time is checked using the
898df930be7Sderaadtpathname created after all the file name modifications have completed.
899df930be7Sderaadt.It Fl Z
900df930be7SderaadtThis option is the same as the
901df930be7Sderaadt.Fl u
902df930be7Sderaadtoption, except that the modification time is checked using the
903df930be7Sderaadtpathname created after all the file name modifications have completed.
904e70d39b4Sjaredy.It Fl z
905e70d39b4SjaredyUse
906e70d39b4Sjaredy.Xr gzip 1
907e70d39b4Sjaredyto compress (decompress) the archive while writing (reading).
908e70d39b4SjaredyIncompatible with
909e70d39b4Sjaredy.Fl a .
910df930be7Sderaadt.El
911df930be7Sderaadt.Pp
912f81d96dfSaaronThe options that operate on the names of files or archive members
913f81d96dfSaaron.Po Fl c ,
914df930be7Sderaadt.Fl i ,
915a914b46dSpvalchev.Fl j ,
916df930be7Sderaadt.Fl n ,
917df930be7Sderaadt.Fl s ,
918df930be7Sderaadt.Fl u ,
919df930be7Sderaadt.Fl v ,
920df930be7Sderaadt.Fl D ,
921df930be7Sderaadt.Fl G ,
922df930be7Sderaadt.Fl T ,
923df930be7Sderaadt.Fl U ,
924df930be7Sderaadt.Fl Y ,
925df930be7Sderaadtand
926f81d96dfSaaron.Fl Z
927f81d96dfSaaron.Pc
928df930be7Sderaadtinteract as follows.
929df930be7Sderaadt.Pp
930f3a5db6dSjmcWhen extracting files during a read operation, archive members are
931df930be7Sderaadt.Sq selected ,
932df930be7Sderaadtbased only on the user specified pattern operands as modified by the
933df930be7Sderaadt.Fl c ,
934df930be7Sderaadt.Fl n ,
935df930be7Sderaadt.Fl u ,
936df930be7Sderaadt.Fl D ,
937df930be7Sderaadt.Fl G ,
938df930be7Sderaadt.Fl T ,
939df930be7Sderaadt.Fl U
940df930be7Sderaadtoptions.
941df930be7SderaadtThen any
942df930be7Sderaadt.Fl s
943df930be7Sderaadtand
944df930be7Sderaadt.Fl i
945df930be7Sderaadtoptions will modify in that order, the names of these selected files.
946df930be7SderaadtThen the
947df930be7Sderaadt.Fl Y
948df930be7Sderaadtand
949df930be7Sderaadt.Fl Z
950df930be7Sderaadtoptions will be applied based on the final pathname.
951f81d96dfSaaronFinally, the
952df930be7Sderaadt.Fl v
953df930be7Sderaadtoption will write the names resulting from these modifications.
954df930be7Sderaadt.Pp
955f3a5db6dSjmcWhen archiving files during a write operation,
956f3a5db6dSjmcor copying files during a copy operation,
957f3a5db6dSjmcarchive members are
958df930be7Sderaadt.Sq selected ,
959df930be7Sderaadtbased only on the user specified pathnames as modified by the
960df930be7Sderaadt.Fl n ,
961df930be7Sderaadt.Fl u ,
962df930be7Sderaadt.Fl D ,
963df930be7Sderaadt.Fl G ,
964df930be7Sderaadt.Fl T ,
965df930be7Sderaadtand
966df930be7Sderaadt.Fl U
967df930be7Sderaadtoptions (the
968df930be7Sderaadt.Fl D
969df930be7Sderaadtoption only applies during a copy operation).
970df930be7SderaadtThen any
971df930be7Sderaadt.Fl s
972df930be7Sderaadtand
973df930be7Sderaadt.Fl i
974df930be7Sderaadtoptions will modify in that order, the names of these selected files.
975f3a5db6dSjmcThen during a copy operation the
976df930be7Sderaadt.Fl Y
977df930be7Sderaadtand the
978df930be7Sderaadt.Fl Z
979df930be7Sderaadtoptions will be applied based on the final pathname.
980f81d96dfSaaronFinally, the
981df930be7Sderaadt.Fl v
982df930be7Sderaadtoption will write the names resulting from these modifications.
983df930be7Sderaadt.Pp
984df930be7SderaadtWhen one or both of the
985df930be7Sderaadt.Fl u
986df930be7Sderaadtor
987df930be7Sderaadt.Fl D
988df930be7Sderaadtoptions are specified along with the
989df930be7Sderaadt.Fl n
990df930be7Sderaadtoption, a file is not considered selected unless it is newer
991df930be7Sderaadtthan the file to which it is compared.
9920cd08285Sjmc.Sh ENVIRONMENT
9930cd08285Sjmc.Bl -tag -width Fl
9940cd08285Sjmc.It Ev TMPDIR
9950cd08285SjmcPath in which to store temporary files.
9960cd08285Sjmc.El
99759a5f2b9Sjmc.Sh EXIT STATUS
998f3a5db6dSjmc.Ex -std pax
999df930be7Sderaadt.Sh EXAMPLES
1000d9bd2a6bSjaredyCopy the contents of the current directory to the device
1001d9bd2a6bSjaredy.Pa /dev/rst0 :
100293256fbcSaaron.Pp
1003d9bd2a6bSjaredy.Dl $ pax -w -f /dev/rst0 \&.
1004df930be7Sderaadt.Pp
1005d9bd2a6bSjaredyGive the verbose table of contents for an archive stored in
1006d9bd2a6bSjaredy.Pa filename :
100793256fbcSaaron.Pp
1008d9bd2a6bSjaredy.Dl $ pax -v -f filename
100993256fbcSaaron.Pp
101093256fbcSaaronThis sequence of commands will copy the entire
1011df930be7Sderaadt.Pa olddir
1012df930be7Sderaadtdirectory hierarchy to
1013d9bd2a6bSjaredy.Pa newdir :
1014d9bd2a6bSjaredy.Bd -literal -offset indent
1015d9bd2a6bSjaredy$ mkdir newdir
1016d9bd2a6bSjaredy$ cd olddir
1017a9710eddSray$ pax -rw . ../newdir
1018d9bd2a6bSjaredy.Ed
1019df930be7Sderaadt.Pp
102010c45587SjmcExtract files from the archive
102110c45587Sjmc.Pa a.pax .
102210c45587SjmcFiles rooted in
1023b3119326Saaron.Pa /usr
102410c45587Sjmcare extracted relative to the current working directory;
102510c45587Sjmcall other files are extracted to their unmodified path.
1026df930be7Sderaadt.Pp
102710c45587Sjmc.Dl $ pax -r -s ',^/usr/,,' -f a.pax
102893256fbcSaaron.Pp
1029d9bd2a6bSjaredyThis can be used to interactively select the files to copy from the
1030d9bd2a6bSjaredycurrent directory to
1031d9bd2a6bSjaredy.Pa dest_dir :
1032df930be7Sderaadt.Pp
1033d9bd2a6bSjaredy.Dl $ pax -rw -i \&. dest_dir
103493256fbcSaaron.Pp
103593256fbcSaaronExtract all files from the archive
1036df930be7Sderaadt.Pa a.pax
1037df930be7Sderaadtwhich are owned by
1038df930be7Sderaadt.Em root
1039df930be7Sderaadtwith group
1040df930be7Sderaadt.Em bin
1041d9bd2a6bSjaredyand preserve all file permissions:
1042df930be7Sderaadt.Pp
1043f3a5db6dSjmc.Dl $ pax -r -pe -U root -G bin -f a.pax
104493256fbcSaaron.Pp
104593256fbcSaaronUpdate (and list) only those files in the destination directory
1046df930be7Sderaadt.Pa /backup
1047df930be7Sderaadtwhich are older (less recent inode change or file modification times) than
1048df930be7Sderaadtfiles with the same name found in the source file tree
1049d9bd2a6bSjaredy.Pa home :
1050d9bd2a6bSjaredy.Pp
1051f3a5db6dSjmc.Dl $ pax -r -w -v -Y -Z home /backup
1052e3085f41Saaron.Sh DIAGNOSTICS
1053df930be7SderaadtWhenever
1054f11c8a18Saaron.Nm
1055df930be7Sderaadtcannot create a file or a link when reading an archive or cannot
1056df930be7Sderaadtfind a file when writing an archive, or cannot preserve the user ID,
1057df930be7Sderaadtgroup ID, or file mode when the
1058df930be7Sderaadt.Fl p
1059cdba0873Saaronoption is specified, a diagnostic message is written to standard error
1060df930be7Sderaadtand a non-zero exit status will be returned, but processing will continue.
1061f81d96dfSaaronIn the case where
1062f11c8a18Saaron.Nm
1063f81d96dfSaaroncannot create a link to a file,
1064f11c8a18Saaron.Nm
1065df930be7Sderaadtwill not create a second copy of the file.
1066df930be7Sderaadt.Pp
1067df930be7SderaadtIf the extraction of a file from an archive is prematurely terminated by
1068df930be7Sderaadta signal or error,
1069f11c8a18Saaron.Nm
1070df930be7Sderaadtmay have only partially extracted a file the user wanted.
1071df930be7SderaadtAdditionally, the file modes of extracted files and directories
1072df930be7Sderaadtmay have incorrect file bits, and the modification and access times may be
1073df930be7Sderaadtwrong.
1074df930be7Sderaadt.Pp
1075df930be7SderaadtIf the creation of an archive is prematurely terminated by a signal or error,
1076f11c8a18Saaron.Nm
1077ff488c0dSjmcmay have only partially created the archive, which may violate the specific
1078df930be7Sderaadtarchive format specification.
1079df930be7Sderaadt.Pp
1080f3a5db6dSjmcIf while doing a copy,
1081f11c8a18Saaron.Nm
1082df930be7Sderaadtdetects a file is about to overwrite itself, the file is not copied,
1083cdba0873Saarona diagnostic message is written to standard error
1084df930be7Sderaadtand when
1085f11c8a18Saaron.Nm
1086df930be7Sderaadtcompletes it will exit with a non-zero exit status.
1087e3085f41Saaron.Sh SEE ALSO
1088e3085f41Saaron.Xr cpio 1 ,
1089e3085f41Saaron.Xr tar 1
1090e3085f41Saaron.Sh STANDARDS
1091e3085f41SaaronThe
1092e3085f41Saaron.Nm
10930f3f4dbcSjmcutility is compliant with the
109499332e38Sjmc.St -p1003.1-2008
1095e7ec4c6dSjmcspecification,
1096e7ec4c6dSjmcexcept that the
1097f3a5db6dSjmc.Cm pax
1098cfc573b5Sjmcarchive format and the
1099f3a5db6dSjmc.Cm listopt
1100cfc573b5Sjmckeyword are unsupported.
11010f3f4dbcSjmc.Pp
11020f3f4dbcSjmcThe flags
1103c2608f17Sjmc.Op Fl 0BDEGjOPTUYZz ,
1104e3085f41Saaronthe archive formats
1105f3a5db6dSjmc.Cm bcpio ,
1106f3a5db6dSjmc.Cm sv4cpio ,
1107f3a5db6dSjmc.Cm sv4crc ,
1108e7ec4c6dSjmcand
1109f3a5db6dSjmc.Cm tar ,
1110e7ec4c6dSjmcthe
1111e7ec4c6dSjmc.Cm b , k ,
1112e7ec4c6dSjmcand
1113e7ec4c6dSjmc.Cm x
1114e7ec4c6dSjmcadditions to the
1115e7ec4c6dSjmc.Fl b
1116e7ec4c6dSjmcflag,
1117f3a5db6dSjmcand the flawed archive handling during list and read operations
11180f3f4dbcSjmcare extensions to that specification.
1119*d273926bSschwarze.Sh HISTORY
1120*d273926bSschwarzeA
1121*d273926bSschwarze.Nm
1122*d273926bSschwarzeutility appeared in
1123*d273926bSschwarze.Bx 4.4 .
11240cd08285Sjmc.Sh AUTHORS
112527e95970Sschwarze.An Keith Muller
112627e95970Sschwarzeat the University of California, San Diego.
1127