source: freewrt/tools/paxmirabilis/src/tar.1@ a569125

freewrt_1_0 freewrt_2_0
Last change on this file since a569125 was a569125, checked in by Thorsten Glaser <tg@…>, 14 years ago

even FreeWRT 1.0-stable deserves paxmirabilis-20120216 compiled with LTO ☺

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

  • Property mode set to 100644
File size: 15.3 KB
RevLine 
[a569125]1.\" $MirOS: src/bin/pax/tar.1,v 1.22 2012/02/12 02:49:41 tg Exp $
2.\" $OpenBSD: tar.1,v 1.55 2010/12/02 04:08:27 tedu Exp $
[c6ac237]3.\"
[a569125]4.\" Copyright (c) 2005, 2008, 2009, 2011, 2012
5.\" Thorsten Glaser <tg@mirbsd.org>
[c6ac237]6.\" Copyright (c) 1996 SigmaSoft, Th. Lockert
7.\" All rights reserved.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[c41ecbb]28.\"-
29.\" Try to make GNU groff and AT&T nroff more compatible
[a569125]30.\" * ` generates ‘ in gnroff, so use \`
31.\" * ' generates ’ in gnroff, \' generates ´, so use \*(aq
32.\" * - generates ‐ in gnroff, \- generates −, so .tr it to -
[c41ecbb]33.\" thus use - for hyphens and \- for minus signs and option dashes
34.\" * ~ is size-reduced and placed atop in groff, so use \*(TI
35.\" * ^ is size-reduced and placed atop in groff, so use \*(ha
36.\" * \(en does not work in nroff, so use \*(en
[a569125]37.\" The section after the "doc" macropackage has been loaded contains
38.\" additional code to convene between the UCB mdoc macropackage (and
39.\" its variant as BSD mdoc in groff) and the GNU mdoc macropackage.
40.\"
[c41ecbb]41.ie \n(.g \{\
[a569125]42. if \*[.T]ascii .tr \-\N'45'
43. if \*[.T]latin1 .tr \-\N'45'
44. if \*[.T]utf8 .tr \-\N'45'
45. ds <= \[<=]
46. ds >= \[>=]
47. ds Rq \[rq]
48. ds Lq \[lq]
49. ds sL \(aq
50. ds sR \(aq
51. if \*[.T]utf8 .ds sL `
52. if \*[.T]ps .ds sL `
53. if \*[.T]utf8 .ds sR '
54. if \*[.T]ps .ds sR '
[c41ecbb]55. ds aq \(aq
56. ds TI \(ti
57. ds ha \(ha
58. ds en \(en
59.\}
60.el \{\
61. ds aq '
62. ds TI ~
63. ds ha ^
64. ds en \(em
65.\}
66.\"
67.\" Implement .Dd with the Mdocdate RCS keyword
[a569125]68.\"
[c41ecbb]69.rn Dd xD
70.de Dd
71.ie \\$1$Mdocdate: \{\
72. xD \\$2 \\$3, \\$4
73.\}
74.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
75..
76.\"
77.\" .Dd must come before definition of .Mx, because when called
78.\" with -mandoc, it might implement .Mx itself, but we want to
79.\" use our own definition. And .Dd must come *first*, always.
[a569125]80.\"
81.Dd $Mdocdate: February 12 2012 $
82.\"
83.\" Check which macro package we use
84.\"
85.ie \n(.g \{\
86. ie d volume-ds-1 .ds tT gnu
87. el .ds tT bsd
88.\}
89.el .ds tT ucb
[c41ecbb]90.\"
91.\" Implement .Mx (MirBSD)
[a569125]92.\"
93.ie "\*(tT"gnu" \{\
94. eo
95. de Mx
96. nr curr-font \n[.f]
97. nr curr-size \n[.ps]
98. ds str-Mx \f[\n[curr-font]]\s[\n[curr-size]u]
99. ds str-Mx1 \*[Tn-font-size]\%MirOS\*[str-Mx]
100. if !\n[arg-limit] \
101. if \n[.$] \{\
102. ds macro-name Mx
103. parse-args \$@
104. \}
105. if (\n[arg-limit] > \n[arg-ptr]) \{\
106. nr arg-ptr +1
107. ie (\n[type\n[arg-ptr]] == 2) \
108. as str-Mx1 \~\*[arg\n[arg-ptr]]
109. el \
110. nr arg-ptr -1
111. \}
112. ds arg\n[arg-ptr] "\*[str-Mx1]
113. nr type\n[arg-ptr] 2
114. ds space\n[arg-ptr] "\*[space]
115. nr num-args (\n[arg-limit] - \n[arg-ptr])
116. nr arg-limit \n[arg-ptr]
117. if \n[num-args] \
118. parse-space-vector
119. print-recursive
120..
121. ec
122. ds sP \s0
123. ds tN \*[Tn-font-size]
[3f0223f]124.\}
[a569125]125.el \{\
126. de Mx
127. nr cF \\n(.f
128. nr cZ \\n(.s
129. ds aa \&\f\\n(cF\s\\n(cZ
130. if \\n(aC==0 \{\
131. ie \\n(.$==0 \&MirOS\\*(aa
132. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
133. \}
134. if \\n(aC>\\n(aP \{\
135. nr aP \\n(aP+1
136. ie \\n(C\\n(aP==2 \{\
137. as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa
138. ie \\n(aC>\\n(aP \{\
139. nr aP \\n(aP+1
140. nR
141. \}
142. el .aZ
143. \}
144. el \{\
145. as b1 \&MirOS\\*(aa
[c41ecbb]146. nR
147. \}
148. \}
[3f0223f]149..
[a569125]150.\}
151.\"-
152.ie \ng==1 \{\
153. ds nc mircpio
154. ds np mirpax
155. ds nt mirtar
156. ds nm mirtar
157. Dt MIRTAR 1
158.\}
159.el .ie \ng==2 \{\
160. ds nc paxcpio
161. ds np pax
162. ds nt paxtar
163. ds nm paxtar
164. Dt PAXTAR 1
165.\}
166.el \{\
167. ds nc cpio
168. ds np pax
169. ds nt tar
170. ds nm tar
171. Dt TAR 1
172.\}
173.\"-
[c41ecbb]174.Os MirBSD
[c6ac237]175.Sh NAME
[a569125]176.ie \ng==1 \{\
177.Nm mirtar
178.Nd tape archiver
179.\}
180.el .ie \ng==2 \{\
181.Nm paxtar
182.Nd tape archiver
183.\}
184.el \{\
[c6ac237]185.Nm tar
186.Nd tape archiver
[a569125]187.\}
[c6ac237]188.Sh SYNOPSIS
[a569125]189.Nm \*(nm
[c6ac237]190.Sm off
[a569125]191.No { Cm crtux No } Op Cm 014578AbefHhJjLmNOoPRSpqsvwXZz
[c6ac237]192.Sm on
193.Bk -words
194.Op Ar blocking-factor | archive | replstr
195.Op Fl C Ar directory
196.Op Fl I Ar file
[a569125]197.Op Ar
[c6ac237]198.Ek
[a569125]199.Nm \*(nm
[c6ac237]200.No { Ns Fl crtux Ns }
[a569125]201.Bk -words
202.Op Fl 014578AeHhJjLmNOoPpqRSvwXZz
[c6ac237]203.Op Fl b Ar blocking-factor
204.Op Fl C Ar directory
205.Op Fl f Ar archive
206.Op Fl I Ar file
[c41ecbb]207.Op Fl M Ar flag
[c6ac237]208.Op Fl s Ar replstr
[a569125]209.Op Ar
210.Ek
[c6ac237]211.Sh DESCRIPTION
212The
213.Nm
214command creates, adds files to, or extracts files from an
215archive file in
216.Dq tar
217format.
218A tar archive is often stored on a magnetic tape, but can be
219stored equally well on a floppy, CD-ROM, or in a regular disk file.
220.Pp
221In the first (legacy) form, all option flags except for
222.Fl C
223and
224.Fl I
225must be contained within the first argument to
226.Nm
227and must not be prefixed by a hyphen
[a569125]228.Pq Sq \- .
[c6ac237]229Option arguments, if any, are processed as subsequent arguments to
230.Nm
231and are processed in the order in which their corresponding option
232flags have been presented on the command line.
233.Pp
234In the second and preferred form, option flags may be given in any order
235and are immediately followed by their corresponding option argument
236values.
237.Pp
238One of the following flags must be present:
239.Bl -tag -width Ds
240.It Fl c
241Create new archive, or overwrite an existing archive,
242adding the specified files to it.
243.It Fl r
244Append the named new files to existing archive.
245Note that this will only work on media on which an end-of-file mark
246can be overwritten.
247.It Fl t
248List contents of archive.
249If any files are named on the
250command line, only those files will be listed.
251The
252.Ar file
253arguments may be specified as glob patterns (see
254.Xr glob 3
255for more information), in which case
256.Nm
257will list all archive members that match each pattern.
258.It Fl u
259Alias for
260.Fl r .
261.It Fl x
262Extract files from archive.
263If any files are named on the
264command line, only those files will be extracted from the
265archive.
266The
267.Ar file
268arguments may be specified as glob patterns (see
269.Xr glob 3
270for more information), in which case
271.Nm
272will extract all archive members that match each pattern.
273.Pp
274If more than one copy of a file exists in the
275archive, later copies will overwrite earlier copies during
276extraction.
277The file mode and modification time are preserved
278if possible.
279The file mode is subject to modification by the
280.Xr umask 2 .
281.El
282.Pp
283In addition to the flags mentioned above, any of the following
284flags may be used:
285.Bl -tag -width Ds
[a569125]286.It Fl A
287Write Unix Archiver libraries instead of tape archives.
[c6ac237]288.It Fl b Ar blocking-factor
289Set blocking factor to use for the archive.
290.Nm
291uses 512-byte blocks.
292The default is 20, the maximum is 126.
293Archives with a blocking factor larger than 63 violate the
294.Tn POSIX
295standard and will not be portable to all systems.
296.It Fl C Ar directory
297This is a positional argument which sets the working directory for the
298following files.
299When extracting, files will be extracted into
300the specified directory; when creating, the specified files will be matched
301from the directory.
302.It Fl e
303Stop after the first error.
304.It Fl f Ar archive
305Filename where the archive is stored.
306Defaults to
307.Pa /dev/rst0 .
308.It Fl H
309Follow symlinks given on the command line only.
310.It Fl h
311Follow symbolic links as if they were normal files
312or directories.
313In extract mode this means that a directory entry in the archive
314will not overwrite an existing symbolic link, but rather what the
315link ultimately points to.
316.It Fl I Ar file
317This is a positional argument which reads the names of files to
318archive or extract from the given file, one per line.
[a569125]319.It Fl J
320Use the xz utility to compress the archive.
321.It Fl j
322Use the bzip2 utility to compress the archive.
[c6ac237]323.It Fl L
324Synonym for the
325.Fl h
326option.
[c41ecbb]327.It Fl M Ar flag
[c6ac237]328Configure the archive normaliser.
[c41ecbb]329.Ar flag
[a569125]330is either a numeric value compatible to
331.Xr strtonum 3
332which is directly stored in the flags word, or
333one of the following values, optionally prefixed with
334.Dq no\-
335to turn them off:
[c6ac237]336.Pp
337.Bl -tag -width xxxxxx -compact
338.It Ar inodes
3390x0001: Serialise inodes, zero device info.
[a569125]340.br
341(cpio, sv4cpio, sv4crc)
[c6ac237]342.It Ar links
3430x0002: Store content of hard links only once.
[a569125]344.br
345(cpio, sv4cpio, sv4crc)
[c6ac237]346.It Ar mtime
3470x0004: Zero out the file modification time.
[a569125]348.br
349(ar, cpio, sv4cpio, sv4crc, ustar)
[c6ac237]350.It Ar uidgid
3510x0008: Set owner to 0:0 (root:wheel).
[a569125]352.br
353(ar, cpio, sv4cpio, sv4crc, ustar)
354.It Ar verb
3550x0010: Debug this option.
356.It Ar debug
3570x0020: Debug file header storage.
[6892a93]358.It Ar lncp
[a569125]3590x0040: Extract hard links by copy if link fails.
360.It Ar numid
3610x0080: Use only numeric uid and gid values.
362.br
363(ustar)
364.It Ar gslash
3650x0100: Append a slash after directory names.
366.br
367(ustar)
368.It Ar set
3690x0003: Keep ownership and mtime intact.
370.It Ar dist
3710x008B: Clean everything except mtime.
372.It Ar norm
3730x008F: Clean everything.
374.It Ar root
3750x0089: Clean owner and device information.
[c6ac237]376.El
377.Pp
[a569125]378This option is only implemented for the ar, cpio, sv4cpio,
[3f0223f]379sv4crc, and ustar file format writing routines.
[c6ac237]380.It Fl m
381Do not preserve modification time.
[a569125]382.It Fl N
383Same as
384.Fl M Ar numid .
[c6ac237]385.It Fl O
[dbbcad4]386If reading, extract files to standard output.
387.br
388If writing, write old-style (non-POSIX) archives.
[c6ac237]389.It Fl o
390Don't write directory information that the older (V7) style
[a569125]391.Nm tar
[c6ac237]392is unable to decode.
393This implies the
394.Fl O
395flag.
396.It Fl P
397Do not strip leading slashes
398.Pq Sq /
399from pathnames.
400The default is to strip leading slashes.
401.It Fl p
402Preserve user and group ID as well as file mode regardless of
403the current
404.Xr umask 2 .
405The setuid and setgid bits are only preserved if the user is
406the superuser.
407Only meaningful in conjunction with the
408.Fl x
409flag.
410.It Fl q
411Select the first archive member that matches each
412.Ar file
413operand.
414No more than one archive member is matched for each
415.Ar file .
416When members of type directory are matched, the file hierarchy rooted at that
417directory is also matched.
418.It Fl R
419Write SysVR4 CPIO files instead of tar or POSIX ustar files.
420Serialise inode numbers, zero out device information.
421The file content of hard links is stored only once.
422.It Fl S
423Write SysVR4 CPIO files with CRC instead of tar or POSIX ustar files.
424Serialise inode numbers, zero out device information.
425The file content of hard links is stored only once.
426.It Fl s Ar replstr
427Modify the archive member names according to the substitution expression
428.Ar replstr ,
429using the syntax of the
430.Xr ed 1
431utility regular expressions.
432.Ar file
433arguments may be given to restrict the list of archive members to those
434specified.
435.Pp
436The format of these regular expressions is
437.Pp
438.Dl /old/new/[gp]
439.Pp
440As in
441.Xr ed 1 ,
442.Va old
443is a basic regular expression (see
444.Xr re_format 7 )
445and
446.Va new
447can contain an ampersand
448.Pq Ql & ,
449.Ql \e Ns Em n
450(where
451.Em n
452is a digit) back-references,
453or subexpression matching.
454The
455.Va old
456string may also contain newline characters.
457Any non-null character can be used as a delimiter
458.Po
459.Ql /
460is shown here
461.Pc .
462Multiple
463.Fl s
464expressions can be specified.
465The expressions are applied in the order they are specified on the
466command line, terminating with the first successful substitution.
467.Pp
468The optional trailing
469.Cm g
470continues to apply the substitution expression to the pathname substring,
471which starts with the first character following the end of the last successful
472substitution.
473The first unsuccessful substitution stops the operation of the
474.Cm g
475option.
476The optional trailing
477.Cm p
478will cause the final result of a successful substitution to be written to
479standard error in the following format:
480.Pp
[a569125]481.D1 Em original-pathname No \*(Gt\*(Gt Em new-pathname
[c6ac237]482.Pp
483File or archive member names that substitute to the empty string
484are not selected and will be skipped.
485.It Fl v
486Verbose operation mode.
487.It Fl w
488Interactively rename files.
489This option causes
490.Nm
491to prompt the user for the filename to use when storing or
492extracting files in an archive.
493.It Fl X
494Do not cross mount points in the file system.
495.It Fl Z
[a569125]496Use the
497.Xr compress 1
498utility to compress the archive.
[c6ac237]499.It Fl z
[a569125]500Use the
501.Xr gzip 1
502utility to compress the archive.
[c6ac237]503.El
504.Pp
505The options
506.Op Fl 014578
507can be used to select one of the compiled-in backup devices,
508.Pa /dev/rstN .
509.Sh ENVIRONMENT
510.Bl -tag -width Fl
511.It Ev TMPDIR
512Path in which to store temporary files.
513.It Ev TAPE
514Default tape device to use instead of
515.Pa /dev/rst0 .
516.El
517.Sh FILES
518.Bl -tag -width "/dev/rst0"
519.It Pa /dev/rst0
520default archive name
521.El
[a569125]522.Sh EXIT STATUS
523The
524.Nm
525utility exits with one of the following values:
526.Pp
527.Bl -tag -width Ds -offset indent -compact
528.It 0
529All files were processed successfully.
530.It 1
531An error occurred.
532.El
[c6ac237]533.Sh EXAMPLES
534Create an archive on the default tape drive, containing the files named
535.Pa bonvole
536and
537.Pa sekve :
538.Pp
[a569125]539.Dl $ \*(nm c bonvole sekve
[c6ac237]540.Pp
541Output a
542.Xr gzip 1
543compressed archive containing the files
544.Pa bonvole
545and
546.Pa sekve
547to a file called
548.Pa foriru.tar.gz :
549.Pp
[a569125]550.Dl $ \*(nm zcf foriru.tar.gz bonvole sekve
[c6ac237]551.Pp
552Verbosely create an archive, called
553.Pa backup.tar.gz ,
554of all files matching the shell
555.Xr glob 3
556function
557.Pa *.c :
558.Pp
[a569125]559.Dl $ \*(nm zcvf backup.tar.gz *.c
[c6ac237]560.Pp
561Verbosely list, but do not extract, all files ending in
562.Pa .jpeg
563from a compressed archive named
564.Pa backup.tar.gz .
565Note that the glob pattern has been quoted to avoid expansion by the shell:
566.Pp
[a569125]567.Dl $ \*(nm tvzf backup.tar.gz \*(aq*.jpeg\*(aq
[c6ac237]568.Pp
569For more detailed examples, see
[a569125]570.Xr \*(np 1 .
[c6ac237]571.Sh DIAGNOSTICS
572Whenever
573.Nm
574cannot create a file or a link when extracting an archive or cannot
575find a file while writing an archive, or cannot preserve the user
576ID, group ID, file mode, or access and modification times when the
577.Fl p
578option is specified, a diagnostic message is written to standard
579error and a non-zero exit value will be returned, but processing
580will continue.
581In the case where
582.Nm
583cannot create a link to a file,
[6892a93]584unless
585.Fl M Ar lncp
586is given,
[c6ac237]587.Nm
588will not create a second copy of the file.
589.Pp
590If the extraction of a file from an archive is prematurely terminated
591by a signal or error,
592.Nm
593may have only partially extracted the file the user wanted.
594Additionally, the file modes of extracted files and directories may
595have incorrect file bits, and the modification and access times may
596be wrong.
597.Pp
598If the creation of an archive is prematurely terminated by a signal
599or error,
600.Nm
601may have only partially created the archive, which may violate the
602specific archive format specification.
603.Sh SEE ALSO
[a569125]604.Xr ar 1 ,
[c6ac237]605.Xr cpio 1 ,
[a569125]606.ie \ng==1 \{\
607.Xr mircpio 1 ,
608.Xr mirpax 1 ,
609.Xr pax 1 ,
610.Xr tar 1 ,
611.Xr deb 5
612.\}
613.el .ie \ng==2 \{\
614.Xr pax 1 ,
615.Xr paxcpio 1 ,
616.Xr tar 1 ,
617.Xr deb 5
618.\}
619.el \{\
[c6ac237]620.Xr pax 1
[a569125]621.\}
[c6ac237]622.Sh HISTORY
623A
[a569125]624.Nm tar
[c6ac237]625command first appeared in
626.At v7 .
627.Sh AUTHORS
628Keith Muller at the University of California, San Diego.
[a569125]629.Pp
630.Mx
631extensions by
632.An Thorsten Glaser Aq tg@mirbsd.org .
[c6ac237]633.Sh CAVEATS
[a569125]634The flags
635.Fl AJjLMNRS
636are not portable to other implementations of
637.Nm tar
638where they may have a different meaning.
Note: See TracBrowser for help on using the repository browser.