source: freewrt/tools/paxmirabilis/src/pax.1@ 3784d08

freewrt_1_0 freewrt_2_0
Last change on this file since 3784d08 was 6892a93, checked in by Thorsten Glaser <tg@…>, 16 years ago

sync with upstream: paxmirabilis-20091027.cpio.gz
(still unmodified source)

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3897 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 32.3 KB
Line 
1.\" $MirOS: src/bin/pax/pax.1,v 1.10 2009/10/27 18:47:26 tg Exp $
2.\" $OpenBSD: pax.1,v 1.52 2007/05/31 19:19:15 jmc Exp $
3.\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
4.\"
5.\" Copyright (c) 2005, 2006 Thorsten Glaser.
6.\" Copyright (c) 1992 Keith Muller.
7.\" Copyright (c) 1992, 1993
8.\" The Regents of the University of California. All rights reserved.
9.\"
10.\" This code is derived from software contributed to Berkeley by
11.\" Keith Muller of the University of California, San Diego.
12.\"
13.\" Redistribution and use in source and binary forms, with or without
14.\" modification, are permitted provided that the following conditions
15.\" are met:
16.\" 1. Redistributions of source code must retain the above copyright
17.\" notice, this list of conditions and the following disclaimer.
18.\" 2. Redistributions in binary form must reproduce the above copyright
19.\" notice, this list of conditions and the following disclaimer in the
20.\" documentation and/or other materials provided with the distribution.
21.\" 3. Neither the name of the University nor the names of its contributors
22.\" may be used to endorse or promote products derived from this software
23.\" without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
36.\"
37.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
38.\"
39.\"-
40.\" Try to make GNU groff and AT&T nroff more compatible
41.\" * ` generates ‘ in groff, so use \`
42.\" * ' generates ’ in groff, \' generates ´, so use \*(aq
43.\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff
44.\" thus use - for hyphens and \- for minus signs and option dashes
45.\" * ~ is size-reduced and placed atop in groff, so use \*(TI
46.\" * ^ is size-reduced and placed atop in groff, so use \*(ha
47.\" * \(en does not work in nroff, so use \*(en
48.ie \n(.g \{\
49. ds aq \(aq
50. ds TI \(ti
51. ds ha \(ha
52. ds en \(en
53.\}
54.el \{\
55. ds aq '
56. ds TI ~
57. ds ha ^
58. ds en \(em
59.\}
60.\"
61.\" Implement .Dd with the Mdocdate RCS keyword
62.rn Dd xD
63.de Dd
64.ie \\$1$Mdocdate: \{\
65. xD \\$2 \\$3, \\$4
66.\}
67.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
68..
69.\"
70.\" .Dd must come before definition of .Mx, because when called
71.\" with -mandoc, it might implement .Mx itself, but we want to
72.\" use our own definition. And .Dd must come *first*, always.
73.Dd $Mdocdate: October 27 2009 $
74.\"
75.\" Implement .Mx (MirBSD)
76.de Mx
77.nr cF \\n(.f
78.nr cZ \\n(.s
79.ds aa \&\f\\n(cF\s\\n(cZ
80.if \\n(aC==0 \{\
81. ie \\n(.$==0 \&MirOS\\*(aa
82. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
83.\}
84.if \\n(aC>\\n(aP \{\
85. nr aP \\n(aP+1
86. ie \\n(C\\n(aP==2 \{\
87. as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa
88. ie \\n(aC>\\n(aP \{\
89. nr aP \\n(aP+1
90. nR
91. \}
92. el .aZ
93. \}
94. el \{\
95. as b1 \&MirOS\\*(aa
96. nR
97. \}
98.\}
99..
100.Dt PAX 1
101.Os MirBSD
102.Sh NAME
103.Nm pax
104.Nd read and write file archives and copy directory hierarchies
105.Sh SYNOPSIS
106.Bk -words
107.Nm pax
108.Op Fl 0cdnOvz
109.Op Fl E Ar limit
110.Op Fl f Ar archive
111.Op Fl G Ar group
112.Op Fl s Ar replstr
113.Op Fl T Ar range
114.Op Fl U Ar user
115.Op Ar pattern ...
116.Nm pax
117.Fl r
118.Op Fl 0cDdiknOuvYZz
119.Op Fl E Ar limit
120.Op Fl f Ar archive
121.Op Fl G Ar group
122.Op Fl o Ar options
123.Op Fl p Ar string
124.Op Fl s Ar replstr
125.Op Fl T Ar range
126.Op Fl U Ar user
127.Op Ar pattern ...
128.Nm pax
129.Fl w
130.Op Fl 0adHiLOPtuvXz
131.Op Fl B Ar bytes
132.Op Fl b Ar blocksize
133.Op Fl f Ar archive
134.Op Fl G Ar group
135.Op Fl M Ar flag
136.Op Fl o Ar options
137.Op Fl s Ar replstr
138.Op Fl T Ar range
139.Op Fl U Ar user
140.Op Fl x Ar format
141.Op Ar file ...
142.Nm pax
143.Fl rw
144.Op Fl 0DdHikLlnOPtuvXYZ
145.Op Fl G Ar group
146.Op Fl p Ar string
147.Op Fl s Ar replstr
148.Op Fl T Ar range
149.Op Fl U Ar user
150.Op Ar file ...
151.Ar directory
152.Ek
153.Sh DESCRIPTION
154.Nm
155will read, write, and list the members of an archive file
156and will copy directory hierarchies.
157.Nm
158operation is independent of the specific archive format
159and supports a wide variety of different archive formats.
160A list of supported archive formats can be found under the description of the
161.Fl x
162option.
163.Pp
164The presence of the
165.Fl r
166and the
167.Fl w
168options specifies which of the following functional modes
169.Nm
170will operate under:
171.Em list , read , write ,
172and
173.Em copy .
174.Bl -tag -width 6n
175.It \*(Ltnone\*(Gt
176.Em List .
177.Nm
178will write to standard output
179a table of contents of the members of the archive file read from
180standard input, whose pathnames match the specified
181.Ar pattern
182arguments.
183The table of contents contains one filename per line
184and is written using single line buffering.
185.It Fl r
186.Em Read .
187.Nm
188extracts the members of the archive file read from the standard input,
189with pathnames matching the specified
190.Ar pattern
191arguments.
192The archive format and blocking is automatically determined on input.
193When an extracted file is a directory, the entire file hierarchy
194rooted at that directory is extracted.
195All extracted files are created relative to the current file hierarchy.
196The setting of ownership, access and modification times, and file mode of
197the extracted files are discussed in more detail under the
198.Fl p
199option.
200.It Fl w
201.Em Write .
202.Nm
203writes an archive containing the
204.Ar file
205operands to standard output
206using the specified archive format.
207When no
208.Ar file
209operands are specified, a list of files to copy with one per line is read from
210standard input.
211When a
212.Ar file
213operand is also a directory, the entire file hierarchy rooted
214at that directory will be included.
215.It Fl rw
216.Em Copy .
217.Nm
218copies the
219.Ar file
220operands to the destination
221.Ar directory .
222When no
223.Ar file
224operands are specified, a list of files to copy with one per line is read from
225the standard input.
226When a
227.Ar file
228operand is also a directory the entire file
229hierarchy rooted at that directory will be included.
230The effect of the
231.Em copy
232is as if the copied files were written to an archive file and then
233subsequently extracted, except that there may be hard links between
234the original and the copied files (see the
235.Fl l
236option below).
237.Pp
238.Sy Warning :
239The destination
240.Ar directory
241must not be one of the
242.Ar file
243operands or a member of a file hierarchy rooted at one of the
244.Ar file
245operands.
246The result of a
247.Em copy
248under these conditions is unpredictable.
249.El
250.Pp
251While processing a damaged archive during a
252.Em read
253or
254.Em list
255operation,
256.Nm
257will attempt to recover from media defects and will search through the archive
258to locate and process the largest number of archive members possible (see the
259.Fl E
260option for more details on error handling).
261.Pp
262The
263.Ar directory
264operand specifies a destination directory pathname.
265If the
266.Ar directory
267operand does not exist, or it is not writable by the user,
268or it is not of type directory,
269.Nm
270will exit with a non-zero exit status.
271.Pp
272The
273.Ar pattern
274operand is used to select one or more pathnames of archive members.
275Archive members are selected using the pattern matching notation described
276by
277.Xr glob 3 .
278When the
279.Ar pattern
280operand is not supplied, all members of the archive will be selected.
281When a
282.Ar pattern
283matches a directory, the entire file hierarchy rooted at that directory will
284be selected.
285When a
286.Ar pattern
287operand does not select at least one archive member,
288.Nm
289will write these
290.Ar pattern
291operands in a diagnostic message to standard error
292and then exit with a non-zero exit status.
293.Pp
294The
295.Ar file
296operand specifies the pathname of a file to be copied or archived.
297When a
298.Ar file
299operand does not select at least one archive member,
300.Nm
301will write these
302.Ar file
303operand pathnames in a diagnostic message to standard error
304and then exit with a non-zero exit status.
305.Pp
306The options are as follows:
307.Bl -tag -width Ds
308.It Fl 0
309Use the NUL
310.Pq Ql \e0
311character as a pathname terminator, instead of newline
312.Pq Ql \en .
313This applies only to the pathnames read from standard input in
314the write and copy modes,
315and to the pathnames written to standard output in list mode.
316This option is expected to be used in concert with the
317.Fl print0
318function in
319.Xr find 1
320or the
321.Fl 0
322flag in
323.Xr xargs 1 .
324.It Fl a
325Append the given
326.Ar file
327operands
328to the end of an archive that was previously written.
329If an archive format is not specified with a
330.Fl x
331option, the format currently being used in the archive will be selected.
332Any attempt to append to an archive in a format different from the
333format already used in the archive will cause
334.Nm
335to exit immediately
336with a non-zero exit status.
337The blocking size used in the archive volume where writing starts
338will continue to be used for the remainder of that archive volume.
339.Pp
340.Sy Warning :
341Many storage devices are not able to support the operations necessary
342to perform an append operation.
343Any attempt to append to an archive stored on such a device may damage the
344archive or have other unpredictable results.
345Tape drives in particular are more likely to not support an append operation.
346An archive stored in a regular file system file or on a disk device will
347usually support an append operation.
348.It Fl B Ar bytes
349Limit the number of bytes written to a single archive volume to
350.Ar bytes .
351The
352.Ar bytes
353limit can end with
354.Sq Li m ,
355.Sq Li k ,
356or
357.Sq Li b
358to specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
359A pair of
360.Ar bytes
361limits can be separated by
362.Sq Li x
363to indicate a product.
364.Pp
365.Em Warning :
366Only use this option when writing an archive to a device which supports
367an end of file read condition based on last (or largest) write offset
368(such as a regular file or a tape drive).
369The use of this option with a floppy or hard disk is not recommended.
370.It Fl b Ar blocksize
371When
372.Em writing
373an archive,
374block the output at a positive decimal integer number of
375bytes per write to the archive file.
376The
377.Ar blocksize
378must be a multiple of 512 bytes with a maximum of 64512 bytes.
379Archive block sizes larger than 32256 bytes violate the
380.Tn POSIX
381standard and will not be portable to all systems.
382A
383.Ar blocksize
384can end with
385.Sq Li k
386or
387.Sq Li b
388to specify multiplication by 1024 (1K) or 512, respectively.
389A pair of
390.Ar blocksizes
391can be separated by
392.Sq Li x
393to indicate a product.
394A specific archive device may impose additional restrictions on the size
395of blocking it will support.
396When blocking is not specified, the default
397.Ar blocksize
398is dependent on the specific archive format being used (see the
399.Fl x
400option).
401.It Fl c
402Match all file or archive members
403.Em except
404those specified by the
405.Ar pattern
406and
407.Ar file
408operands.
409.It Fl D
410This option is the same as the
411.Fl u
412option, except that the file inode change time is checked instead of the
413file modification time.
414The file inode change time can be used to select files whose inode information
415(e.g., UID, GID, etc.) is newer than a copy of the file in the destination
416.Ar directory .
417.It Fl d
418Cause files of type directory being copied or archived, or archive members of
419type directory being extracted, to match only the directory file or archive
420member and not the file hierarchy rooted at the directory.
421.It Fl E Ar limit
422Limit the number of consecutive read faults while trying to read a flawed
423archive to
424.Ar limit .
425With a positive
426.Ar limit ,
427.Nm
428will attempt to recover from an archive read error and will
429continue processing starting with the next file stored in the archive.
430A
431.Ar limit
432of 0 will cause
433.Nm
434to stop operation after the first read error is detected on an archive volume.
435A
436.Ar limit
437of
438.Li NONE
439will cause
440.Nm
441to attempt to recover from read errors forever.
442The default
443.Ar limit
444is a small positive number of retries.
445.Pp
446.Em Warning :
447Using this option with
448.Li NONE
449should be used with extreme caution as
450.Nm
451may get stuck in an infinite loop on a very badly flawed archive.
452.It Fl f Ar archive
453Specify
454.Ar archive
455as the pathname of the input or output archive, overriding the default
456standard input (for
457.Em list
458and
459.Em read )
460or standard output
461(for
462.Em write ) .
463A single archive may span multiple files and different archive devices.
464When required,
465.Nm
466will prompt for the pathname of the file or device of the next volume in the
467archive.
468.It Fl G Ar group
469Select a file based on its
470.Ar group
471name, or when starting with a
472.Cm # ,
473a numeric GID.
474A
475.Ql \e
476can be used to escape the
477.Cm # .
478Multiple
479.Fl G
480options may be supplied and checking stops with the first match.
481.It Fl H
482Follow only command-line symbolic links while performing a physical file
483system traversal.
484.It Fl i
485Interactively rename files or archive members.
486For each archive member matching a
487.Ar pattern
488operand or each file matching a
489.Ar file
490operand,
491.Nm
492will prompt to
493.Pa /dev/tty
494giving the name of the file, its file mode, and its modification time.
495.Nm
496will then read a line from
497.Pa /dev/tty .
498If this line is blank, the file or archive member is skipped.
499If this line consists of a single period, the
500file or archive member is processed with no modification to its name.
501Otherwise, its name is replaced with the contents of the line.
502.Nm
503will immediately exit with a non-zero exit status if
504.Dv EOF
505is encountered when reading a response or if
506.Pa /dev/tty
507cannot be opened for reading and writing.
508.It Fl k
509Do not overwrite existing files.
510.It Fl L
511Follow all symbolic links to perform a logical file system traversal.
512.It Fl l
513(The lowercase letter
514.Dq ell . )
515Link files.
516In the
517.Em copy
518mode
519.Pq Fl r Fl w ,
520hard links are made between the source and destination file hierarchies
521whenever possible.
522.It Fl M Ar flag
523Configure the archive normaliser.
524.Ar flag
525is either a number or a string, optionally prefixed with
526.Dq no-
527to turn it off.
528See
529.Xr cpio 1
530for a comprehensive list and compatibility notes.
531.Pp
532.Bl -tag -width xxxxxx -compact
533.It Ar inodes
5340x0001: Serialise inodes, zero device info.
535.It Ar links
5360x0002: Store content of hard links only once.
537.It Ar mtime
5380x0004: Zero out the file modification time.
539.It Ar uidgid
5400x0008: Set owner to 0:0 (root:wheel).
541.It Ar lncp
5420x0040: Extract hard links by copying if linking fails.
543.El
544.Pp
545This option is only implemented for the cpio, sv4cpio,
546sv4crc, and ustar file format writing routines.
547For the ustar format, the
548.Ar inodes
549and
550.Ar links
551specifiers are ignored.
552TODO: The
553.Nm pax
554frontend should be using the
555.Fl o
556option for handling this feature instead.
557.It Fl n
558Select the first archive member that matches each
559.Ar pattern
560operand.
561No more than one archive member is matched for each
562.Ar pattern .
563When members of type directory are matched, the file hierarchy rooted at that
564directory is also matched (unless
565.Fl d
566is also specified).
567.It Fl O
568Force the archive to be one volume.
569If a volume ends prematurely,
570.Nm
571will not prompt for a new volume.
572This option can be useful for
573automated tasks where error recovery cannot be performed by a human.
574.It Fl o Ar options
575Information to modify the algorithm for extracting or writing archive files
576which is specific to the archive format specified by
577.Fl x .
578In general,
579.Ar options
580take the form:
581.Ar name Ns = Ns Ar value .
582.Pp
583The following options are available for the old
584.Bx
585.Em tar
586format:
587.Pp
588.Bl -tag -width Ds -compact
589.It Cm nodir
590.It Cm write_opt=nodir
591When writing archives, omit the storage of directories.
592.El
593.It Fl P
594Do not follow symbolic links, perform a physical file system traversal.
595This is the default mode.
596.It Fl p Ar string
597Specify one or more file characteristic options (privileges).
598The
599.Ar string
600option-argument is a string specifying file characteristics to be retained or
601discarded on extraction.
602The string consists of the specification characters
603.Cm a , e , m , o ,
604and
605.Cm p .
606Multiple characteristics can be concatenated within the same string
607and multiple
608.Fl p
609options can be specified.
610The meanings of the specification characters are as follows:
611.Bl -tag -width 2n
612.It Cm a
613Do not preserve file access times.
614By default, file access times are preserved whenever possible.
615.It Cm e
616.Dq Preserve everything ,
617the user ID, group ID, file mode bits,
618file access time, and file modification time.
619This is intended to be used by
620.Em root ,
621someone with all the appropriate privileges, in order to preserve all
622aspects of the files as they are recorded in the archive.
623The
624.Cm e
625flag is the sum of the
626.Cm o
627and
628.Cm p
629flags.
630.It Cm m
631Do not preserve file modification times.
632By default, file modification times are preserved whenever possible.
633.It Cm o
634Preserve the user ID and group ID.
635.It Cm p
636.Dq Preserve
637the file mode bits.
638This is intended to be used by a
639.Em user
640with regular privileges who wants to preserve all aspects of the file other
641than the ownership.
642The file times are preserved by default, but two other flags are offered to
643disable this and use the time of extraction instead.
644.El
645.Pp
646In the preceding list,
647.Sq preserve
648indicates that an attribute stored in the archive is given to the
649extracted file, subject to the permissions of the invoking
650process.
651Otherwise the attribute of the extracted file is determined as
652part of the normal file creation action.
653If neither the
654.Cm e
655nor the
656.Cm o
657specification character is specified, or the user ID and group ID are not
658preserved for any reason,
659.Nm
660will not set the
661.Dv S_ISUID
662.Em ( setuid )
663and
664.Dv S_ISGID
665.Em ( setgid )
666bits of the file mode.
667If the preservation of any of these items fails for any reason,
668.Nm
669will write a diagnostic message to standard error.
670Failure to preserve these items will affect the final exit status,
671but will not cause the extracted file to be deleted.
672If the file characteristic letters in any of the string option-arguments are
673duplicated or conflict with each other, the one(s) given last will take
674precedence.
675For example, if
676.Fl p Ar eme
677is specified, file modification times are still preserved.
678.It Fl r
679Read an archive file from standard input
680and extract the specified
681.Ar file
682operands.
683If any intermediate directories are needed in order to extract an archive
684member, these directories will be created as if
685.Xr mkdir 2
686was called with the bitwise inclusive
687.Tn OR
688of
689.Dv S_IRWXU , S_IRWXG ,
690and
691.Dv S_IRWXO
692as the mode argument.
693When the selected archive format supports the specification of linked
694files and these files cannot be linked while the archive is being extracted,
695.Nm
696will write a diagnostic message to standard error
697and exit with a non-zero exit status at the completion of operation.
698.It Fl s Ar replstr
699Modify the archive member names according to the substitution expression
700.Ar replstr ,
701using the syntax of the
702.Xr ed 1
703utility regular expressions.
704.Ar file
705or
706.Ar pattern
707arguments may be given to restrict the list of archive members to those
708specified.
709.Pp
710The format of these regular expressions is:
711.Pp
712.Dl /old/new/[gp]
713.Pp
714As in
715.Xr ed 1 ,
716.Ar old
717is a basic regular expression (see
718.Xr re_format 7 )
719and
720.Ar new
721can contain an ampersand
722.Pq Ql & ,
723.Ql \e Ns Em n
724(where
725.Em n
726is a digit) back-references,
727or subexpression matching.
728The
729.Ar old
730string may also contain newline characters.
731Any non-null character can be used as a delimiter
732.Po
733.Ql /
734is shown here
735.Pc .
736Multiple
737.Fl s
738expressions can be specified.
739The expressions are applied in the order they are specified on the
740command line, terminating with the first successful substitution.
741.Pp
742The optional trailing
743.Cm g
744continues to apply the substitution expression to the pathname substring,
745which starts with the first character following the end of the last successful
746substitution.
747The first unsuccessful substitution stops the operation of the
748.Cm g
749option.
750The optional trailing
751.Cm p
752will cause the final result of a successful substitution to be written to
753standard error in the following format:
754.Pp
755.D1 Em original-pathname No \*(Gt\*(Gt Em new-pathname
756.Pp
757File or archive member names that substitute to the empty string
758are not selected and will be skipped.
759.It Fl T Ar range
760Allow files to be selected based on a file modification or inode change
761time falling within the specified time range.
762The range has the format:
763.Sm off
764.Bd -filled -offset indent
765.Oo Ar from_date Oc Oo ,
766.Ar to_date Oc Oo /
767.Oo Cm c Oc Op Cm m Oc
768.Ed
769.Sm on
770.Pp
771The dates specified by
772.Ar from_date
773to
774.Ar to_date
775are inclusive.
776If only a
777.Ar from_date
778is supplied, all files with a modification or inode change time
779equal to or younger are selected.
780If only a
781.Ar to_date
782is supplied, all files with a modification or inode change time
783equal to or older will be selected.
784When the
785.Ar from_date
786is equal to the
787.Ar to_date ,
788only files with a modification or inode change time of exactly that
789time will be selected.
790.Pp
791When
792.Nm
793is in the
794.Em write
795or
796.Em copy
797mode, the optional trailing field
798.Oo Cm c Oc Op Cm m
799can be used to determine which file time (inode change, file modification or
800both) are used in the comparison.
801If neither is specified, the default is to use file modification time only.
802The
803.Cm m
804specifies the comparison of file modification time (the time when
805the file was last written).
806The
807.Cm c
808specifies the comparison of inode change time (the time when the file
809inode was last changed; e.g., a change of owner, group, mode, etc).
810When
811.Cm c
812and
813.Cm m
814are both specified, then the modification and inode change times are
815both compared.
816.Pp
817The inode change time comparison is useful in selecting files whose
818attributes were recently changed or selecting files which were recently
819created and had their modification time reset to an older time (as what
820happens when a file is extracted from an archive and the modification time
821is preserved).
822Time comparisons using both file times is useful when
823.Nm
824is used to create a time based incremental archive (only files that were
825changed during a specified time range will be archived).
826.Pp
827A time range is made up of six different fields and each field must contain two
828digits.
829The format is:
830.Pp
831.Dl [[[[[cc]yy]mm]dd]HH]MM[.SS]
832.Pp
833Where
834.Ar cc
835is the first two digits of the year (the century),
836.Ar yy
837is the last two digits of the year,
838the first
839.Ar mm
840is the month (from 01 to 12),
841.Ar dd
842is the day of the month (from 01 to 31),
843.Ar HH
844is the hour of the day (from 00 to 23),
845.Ar MM
846is the minute (from 00 to 59),
847and
848.Ar SS
849is the seconds (from 00 to 59).
850The minute field
851.Ar MM
852is required, while the other fields are optional and must be added in the
853following order:
854.Ar HH , dd , mm ,
855.Ar yy , cc .
856.Pp
857The
858.Ar SS
859field may be added independently of the other fields.
860Time ranges are relative to the current time, so
861.Ic -T 1234/cm
862would select all files with a modification or inode change time
863of 12:34 PM today or later.
864Multiple
865.Fl T
866time range can be supplied and checking stops with the first match.
867.It Fl t
868Reset the access times of any file or directory read or accessed by
869.Nm
870to be the same as they were before being read or accessed by
871.Nm pax .
872.It Fl U Ar user
873Select a file based on its
874.Ar user
875name, or when starting with a
876.Cm # ,
877a numeric UID.
878A
879.Ql \e
880can be used to escape the
881.Cm # .
882Multiple
883.Fl U
884options may be supplied and checking stops with the first match.
885.It Fl u
886Ignore files that are older (having a less recent file modification time)
887than a pre-existing file or archive member with the same name.
888During
889.Em read ,
890an archive member with the same name as a file in the file system will be
891extracted if the archive member is newer than the file.
892During
893.Em write ,
894a file system member with the same name as an archive member will be
895written to the archive if it is newer than the archive member.
896During
897.Em copy ,
898the file in the destination hierarchy is replaced by the file in the source
899hierarchy or by a link to the file in the source hierarchy if the file in
900the source hierarchy is newer.
901.It Fl v
902During a
903.Em list
904operation, produce a verbose table of contents using the format of the
905.Xr ls 1
906utility with the
907.Fl l
908option.
909For pathnames representing a hard link to a previous member of the archive,
910the output has the format:
911.Pp
912.Dl Em ls -l listing Li == Em link-name
913.Pp
914For pathnames representing a symbolic link, the output has the format:
915.Pp
916.Dl Em ls -l listing Li =\*(Gt Em link-name
917.Pp
918Where
919.Em ls -l listing
920is the output format specified by the
921.Xr ls 1
922utility when used with the
923.Fl l
924option.
925Otherwise for all the other operational modes
926.Po Em read , write , No and Em copy
927.Pc ,
928pathnames are written and flushed to standard error
929without a trailing newline
930as soon as processing begins on that file or
931archive member.
932The trailing newline
933is not buffered and is written only after the file has been read or written.
934.It Fl w
935Write files to the standard output
936in the specified archive format.
937When no
938.Ar file
939operands are specified, standard input
940is read for a list of pathnames with one per line without any leading or
941trailing
942.Aq blanks .
943.It Fl X
944When traversing the file hierarchy specified by a pathname,
945do not descend into directories that have a different device ID.
946See the
947.Li st_dev
948field as described in
949.Xr stat 2
950for more information about device IDs.
951.It Fl x Ar format
952Specify the output archive format, with the default format being
953.Cm ustar .
954.Nm
955currently supports the following formats:
956.Bl -tag -width "sv4cpio"
957.It Cm bcpio
958The old binary cpio format.
959The default blocksize for this format is 5120 bytes.
960This format is not very portable and should not be used when other formats
961are available.
962Inode and device information about a file (used for detecting file hard links
963by this format), which may be truncated by this format, is detected by
964.Nm
965and is repaired.
966.It Cm cpio
967The extended cpio interchange format specified in the
968.St -p1003.2
969standard.
970The default blocksize for this format is 5120 bytes.
971Inode and device information about a file (used for detecting file hard links
972by this format), which may be truncated by this format, is detected by
973.Nm
974and is repaired.
975.It Cm sv4cpio
976The System V release 4 cpio.
977The default blocksize for this format is 5120 bytes.
978Inode and device information about a file (used for detecting file hard links
979by this format), which may be truncated by this format, is detected by
980.Nm
981and is repaired.
982.It Cm sv4crc
983The System V release 4 cpio with file CRC checksums.
984The default blocksize for this format is 5120 bytes.
985Inode and device information about a file (used for detecting file hard links
986by this format), which may be truncated by this format, is detected by
987.Nm
988and is repaired.
989.It Cm tar
990The old
991.Bx
992tar format as found in
993.Bx 4.3 .
994The default blocksize for this format is 10240 bytes.
995Pathnames stored by this format must be 100 characters or less in length.
996Only
997.Em regular
998files,
999.Em hard links , soft links ,
1000and
1001.Em directories
1002will be archived (other file system types are not supported).
1003For backwards compatibility with even older tar formats, a
1004.Fl o
1005option can be used when writing an archive to omit the storage of directories.
1006This option takes the form:
1007.Pp
1008.Dl Fl o Cm write_opt=nodir
1009.It Cm ustar
1010The extended tar interchange format specified in the
1011.St -p1003.2
1012standard.
1013The default blocksize for this format is 10240 bytes.
1014Filenames stored by this format must be 100 characters or less in length;
1015the total pathname must be 255 characters or less.
1016.El
1017.Pp
1018.Nm
1019will detect and report any file that it is unable to store or extract
1020as the result of any specific archive format restrictions.
1021The individual archive formats may impose additional restrictions on use.
1022Typical archive format restrictions include (but are not limited to):
1023file pathname length, file size, link pathname length, and the type of the
1024file.
1025.It Fl Y
1026This option is the same as the
1027.Fl D
1028option, except that the inode change time is checked using the
1029pathname created after all the file name modifications have completed.
1030.It Fl Z
1031This option is the same as the
1032.Fl u
1033option, except that the modification time is checked using the
1034pathname created after all the file name modifications have completed.
1035.It Fl z
1036Use
1037.Xr gzip 1
1038to compress (decompress) the archive while writing (reading).
1039Incompatible with
1040.Fl a .
1041.El
1042.Pp
1043The options that operate on the names of files or archive members
1044.Po Fl c ,
1045.Fl i ,
1046.Fl n ,
1047.Fl s ,
1048.Fl u ,
1049.Fl v ,
1050.Fl D ,
1051.Fl G ,
1052.Fl T ,
1053.Fl U ,
1054.Fl Y ,
1055and
1056.Fl Z
1057.Pc
1058interact as follows.
1059.Pp
1060When extracting files during a
1061.Em read
1062operation, archive members are
1063.Sq selected ,
1064based only on the user specified pattern operands as modified by the
1065.Fl c ,
1066.Fl n ,
1067.Fl u ,
1068.Fl D ,
1069.Fl G ,
1070.Fl T ,
1071.Fl U
1072options.
1073Then any
1074.Fl s
1075and
1076.Fl i
1077options will modify in that order, the names of these selected files.
1078Then the
1079.Fl Y
1080and
1081.Fl Z
1082options will be applied based on the final pathname.
1083Finally, the
1084.Fl v
1085option will write the names resulting from these modifications.
1086.Pp
1087When archiving files during a
1088.Em write
1089operation, or copying files during a
1090.Em copy
1091operation, archive members are
1092.Sq selected ,
1093based only on the user specified pathnames as modified by the
1094.Fl n ,
1095.Fl u ,
1096.Fl D ,
1097.Fl G ,
1098.Fl T ,
1099and
1100.Fl U
1101options (the
1102.Fl D
1103option only applies during a copy operation).
1104Then any
1105.Fl s
1106and
1107.Fl i
1108options will modify in that order, the names of these selected files.
1109Then during a
1110.Em copy
1111operation the
1112.Fl Y
1113and the
1114.Fl Z
1115options will be applied based on the final pathname.
1116Finally, the
1117.Fl v
1118option will write the names resulting from these modifications.
1119.Pp
1120When one or both of the
1121.Fl u
1122or
1123.Fl D
1124options are specified along with the
1125.Fl n
1126option, a file is not considered selected unless it is newer
1127than the file to which it is compared.
1128.Sh ENVIRONMENT
1129.Bl -tag -width Fl
1130.It Ev TMPDIR
1131Path in which to store temporary files.
1132.El
1133.Sh EXAMPLES
1134Copy the contents of the current directory to the device
1135.Pa /dev/rst0 :
1136.Pp
1137.Dl $ pax -w -f /dev/rst0 \&.
1138.Pp
1139Give the verbose table of contents for an archive stored in
1140.Pa filename :
1141.Pp
1142.Dl $ pax -v -f filename
1143.Pp
1144This sequence of commands will copy the entire
1145.Pa olddir
1146directory hierarchy to
1147.Pa newdir :
1148.Bd -literal -offset indent
1149$ mkdir newdir
1150$ cd olddir
1151$ pax -rw . ../newdir
1152.Ed
1153.Pp
1154Extract files from the archive
1155.Pa a.pax .
1156Files rooted in
1157.Pa /usr
1158are extracted relative to the current working directory;
1159all other files are extracted to their unmodified path.
1160.Pp
1161.Dl $ pax -r -s ',^/usr/,,' -f a.pax
1162.Pp
1163This can be used to interactively select the files to copy from the
1164current directory to
1165.Pa dest_dir :
1166.Pp
1167.Dl $ pax -rw -i \&. dest_dir
1168.Pp
1169Extract all files from the archive
1170.Pa a.pax
1171which are owned by
1172.Em root
1173with group
1174.Em bin
1175and preserve all file permissions:
1176.Pp
1177.Dl "$ pax -r -pe -U root -G bin -f a.pax"
1178.Pp
1179Update (and list) only those files in the destination directory
1180.Pa /backup
1181which are older (less recent inode change or file modification times) than
1182files with the same name found in the source file tree
1183.Pa home :
1184.Pp
1185.Dl "$ pax -r -w -v -Y -Z home /backup"
1186.Sh DIAGNOSTICS
1187.Nm
1188will exit with one of the following values:
1189.Bl -tag -width 2n -offset indent
1190.It 0
1191All files were processed successfully.
1192.It 1
1193An error occurred.
1194.El
1195.Pp
1196Whenever
1197.Nm
1198cannot create a file or a link when reading an archive or cannot
1199find a file when writing an archive, or cannot preserve the user ID,
1200group ID, or file mode when the
1201.Fl p
1202option is specified, a diagnostic message is written to standard error
1203and a non-zero exit status will be returned, but processing will continue.
1204In the case where
1205.Nm
1206cannot create a link to a file,
1207unless
1208.Fl M Ar lncp
1209is given,
1210.Nm
1211will not create a second copy of the file.
1212.Pp
1213If the extraction of a file from an archive is prematurely terminated by
1214a signal or error,
1215.Nm
1216may have only partially extracted a file the user wanted.
1217Additionally, the file modes of extracted files and directories
1218may have incorrect file bits, and the modification and access times may be
1219wrong.
1220.Pp
1221If the creation of an archive is prematurely terminated by a signal or error,
1222.Nm
1223may have only partially created the archive, which may violate the specific
1224archive format specification.
1225.Pp
1226If while doing a
1227.Em copy ,
1228.Nm
1229detects a file is about to overwrite itself, the file is not copied,
1230a diagnostic message is written to standard error
1231and when
1232.Nm
1233completes it will exit with a non-zero exit status.
1234.Sh SEE ALSO
1235.Xr cpio 1 ,
1236.Xr tar 1
1237.Sh STANDARDS
1238The
1239.Nm
1240utility is compliant with the
1241.St -p1003.1-2004
1242specification.
1243.Pp
1244The flags
1245.Op Fl 0BDEGHLMOPTUYZz ,
1246the archive formats
1247.Em bcpio ,
1248.Em sv4cpio ,
1249.Em sv4crc ,
1250.Em tar ,
1251and the flawed archive handling during
1252.Em list
1253and
1254.Em read
1255operations
1256are extensions to that specification.
1257.Sh AUTHORS
1258Keith Muller at the University of California, San Diego.
1259.Pp
1260.Mx
1261extensions by
1262.An Thorsten Glaser Aq tg@mirbsd.de .
Note: See TracBrowser for help on using the repository browser.