source: freewrt/tools/paxmirabilis/src/tar.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: 12.6 KB
Line 
1.\" $MirOS: src/bin/pax/tar.1,v 1.11 2009/10/27 18:47:27 tg Exp $
2.\" $OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $
3.\"
4.\" Copyright (c) 1996 SigmaSoft, Th. Lockert
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" $OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $
28.\"
29.\"-
30.\" Try to make GNU groff and AT&T nroff more compatible
31.\" * ` generates ‘ in groff, so use \`
32.\" * ' generates ’ in groff, \' generates ´, so use \*(aq
33.\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff
34.\" thus use - for hyphens and \- for minus signs and option dashes
35.\" * ~ is size-reduced and placed atop in groff, so use \*(TI
36.\" * ^ is size-reduced and placed atop in groff, so use \*(ha
37.\" * \(en does not work in nroff, so use \*(en
38.ie \n(.g \{\
39. ds aq \(aq
40. ds TI \(ti
41. ds ha \(ha
42. ds en \(en
43.\}
44.el \{\
45. ds aq '
46. ds TI ~
47. ds ha ^
48. ds en \(em
49.\}
50.\"
51.\" Implement .Dd with the Mdocdate RCS keyword
52.rn Dd xD
53.de Dd
54.ie \\$1$Mdocdate: \{\
55. xD \\$2 \\$3, \\$4
56.\}
57.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
58..
59.\"
60.\" .Dd must come before definition of .Mx, because when called
61.\" with -mandoc, it might implement .Mx itself, but we want to
62.\" use our own definition. And .Dd must come *first*, always.
63.Dd $Mdocdate: October 27 2009 $
64.\"
65.\" Implement .Mx (MirBSD)
66.de Mx
67.nr cF \\n(.f
68.nr cZ \\n(.s
69.ds aa \&\f\\n(cF\s\\n(cZ
70.if \\n(aC==0 \{\
71. ie \\n(.$==0 \&MirOS\\*(aa
72. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
73.\}
74.if \\n(aC>\\n(aP \{\
75. nr aP \\n(aP+1
76. ie \\n(C\\n(aP==2 \{\
77. as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa
78. ie \\n(aC>\\n(aP \{\
79. nr aP \\n(aP+1
80. nR
81. \}
82. el .aZ
83. \}
84. el \{\
85. as b1 \&MirOS\\*(aa
86. nR
87. \}
88.\}
89..
90.Dt TAR 1
91.Os MirBSD
92.Sh NAME
93.Nm tar
94.Nd tape archiver
95.Sh SYNOPSIS
96.Nm tar
97.Sm off
98.No { Cm crtux No } Op Cm 014578befHhLmOoPRSpqsvwXZz
99.Sm on
100.Bk -words
101.Op Ar blocking-factor | archive | replstr
102.Op Fl C Ar directory
103.Op Fl I Ar file
104.Op Ar file ...
105.Ek
106.Pp
107.Nm tar
108.No { Ns Fl crtux Ns }
109.Op Fl 014578eHhLmOoPpqRSvwXZz
110.Op Fl b Ar blocking-factor
111.Op Fl C Ar directory
112.Op Fl f Ar archive
113.Op Fl I Ar file
114.Op Fl M Ar flag
115.Op Fl s Ar replstr
116.Op Ar file ...
117.Sh DESCRIPTION
118The
119.Nm
120command creates, adds files to, or extracts files from an
121archive file in
122.Dq tar
123format.
124A tar archive is often stored on a magnetic tape, but can be
125stored equally well on a floppy, CD-ROM, or in a regular disk file.
126.Pp
127In the first (legacy) form, all option flags except for
128.Fl C
129and
130.Fl I
131must be contained within the first argument to
132.Nm
133and must not be prefixed by a hyphen
134.Pq Sq - .
135Option arguments, if any, are processed as subsequent arguments to
136.Nm
137and are processed in the order in which their corresponding option
138flags have been presented on the command line.
139.Pp
140In the second and preferred form, option flags may be given in any order
141and are immediately followed by their corresponding option argument
142values.
143.Pp
144One of the following flags must be present:
145.Bl -tag -width Ds
146.It Fl c
147Create new archive, or overwrite an existing archive,
148adding the specified files to it.
149.It Fl r
150Append the named new files to existing archive.
151Note that this will only work on media on which an end-of-file mark
152can be overwritten.
153.It Fl t
154List contents of archive.
155If any files are named on the
156command line, only those files will be listed.
157The
158.Ar file
159arguments may be specified as glob patterns (see
160.Xr glob 3
161for more information), in which case
162.Nm
163will list all archive members that match each pattern.
164.It Fl u
165Alias for
166.Fl r .
167.It Fl x
168Extract files from archive.
169If any files are named on the
170command line, only those files will be extracted from the
171archive.
172The
173.Ar file
174arguments may be specified as glob patterns (see
175.Xr glob 3
176for more information), in which case
177.Nm
178will extract all archive members that match each pattern.
179.Pp
180If more than one copy of a file exists in the
181archive, later copies will overwrite earlier copies during
182extraction.
183The file mode and modification time are preserved
184if possible.
185The file mode is subject to modification by the
186.Xr umask 2 .
187.El
188.Pp
189In addition to the flags mentioned above, any of the following
190flags may be used:
191.Bl -tag -width Ds
192.It Fl b Ar blocking-factor
193Set blocking factor to use for the archive.
194.Nm
195uses 512-byte blocks.
196The default is 20, the maximum is 126.
197Archives with a blocking factor larger than 63 violate the
198.Tn POSIX
199standard and will not be portable to all systems.
200.It Fl C Ar directory
201This is a positional argument which sets the working directory for the
202following files.
203When extracting, files will be extracted into
204the specified directory; when creating, the specified files will be matched
205from the directory.
206.It Fl e
207Stop after the first error.
208.It Fl f Ar archive
209Filename where the archive is stored.
210Defaults to
211.Pa /dev/rst0 .
212.It Fl H
213Follow symlinks given on the command line only.
214.It Fl h
215Follow symbolic links as if they were normal files
216or directories.
217In extract mode this means that a directory entry in the archive
218will not overwrite an existing symbolic link, but rather what the
219link ultimately points to.
220.It Fl I Ar file
221This is a positional argument which reads the names of files to
222archive or extract from the given file, one per line.
223.It Fl L
224Synonym for the
225.Fl h
226option.
227.It Fl M Ar flag
228Configure the archive normaliser.
229.Ar flag
230is either a number or a string, optionally prefixed with
231.Dq no-
232to turn it off.
233See
234.Xr cpio 1
235for a comprehensive list and compatibility notes.
236.Pp
237.Bl -tag -width xxxxxx -compact
238.It Ar inodes
2390x0001: Serialise inodes, zero device info.
240.It Ar links
2410x0002: Store content of hard links only once.
242.It Ar mtime
2430x0004: Zero out the file modification time.
244.It Ar uidgid
2450x0008: Set owner to 0:0 (root:wheel).
246.It Ar lncp
2470x0040: Extract hard links by copying if linking fails.
248.El
249.Pp
250This option is only implemented for the cpio, sv4cpio,
251sv4crc, and ustar file format writing routines.
252For the ustar format, the
253.Ar inodes
254and
255.Ar links
256specifiers are ignored.
257.It Fl m
258Do not preserve modification time.
259.It Fl O
260If reading, extract files to standard output.
261.br
262If writing, write old-style (non-POSIX) archives.
263.It Fl o
264Don't write directory information that the older (V7) style
265.Nm
266is unable to decode.
267This implies the
268.Fl O
269flag.
270.It Fl P
271Do not strip leading slashes
272.Pq Sq /
273from pathnames.
274The default is to strip leading slashes.
275.It Fl p
276Preserve user and group ID as well as file mode regardless of
277the current
278.Xr umask 2 .
279The setuid and setgid bits are only preserved if the user is
280the superuser.
281Only meaningful in conjunction with the
282.Fl x
283flag.
284.It Fl q
285Select the first archive member that matches each
286.Ar file
287operand.
288No more than one archive member is matched for each
289.Ar file .
290When members of type directory are matched, the file hierarchy rooted at that
291directory is also matched.
292.It Fl R
293Write SysVR4 CPIO files instead of tar or POSIX ustar files.
294Serialise inode numbers, zero out device information.
295The file content of hard links is stored only once.
296.It Fl S
297Write SysVR4 CPIO files with CRC instead of tar or POSIX ustar files.
298Serialise inode numbers, zero out device information.
299The file content of hard links is stored only once.
300.It Fl s Ar replstr
301Modify the archive member names according to the substitution expression
302.Ar replstr ,
303using the syntax of the
304.Xr ed 1
305utility regular expressions.
306.Ar file
307arguments may be given to restrict the list of archive members to those
308specified.
309.Pp
310The format of these regular expressions is
311.Pp
312.Dl /old/new/[gp]
313.Pp
314As in
315.Xr ed 1 ,
316.Va old
317is a basic regular expression (see
318.Xr re_format 7 )
319and
320.Va new
321can contain an ampersand
322.Pq Ql & ,
323.Ql \e Ns Em n
324(where
325.Em n
326is a digit) back-references,
327or subexpression matching.
328The
329.Va old
330string may also contain newline characters.
331Any non-null character can be used as a delimiter
332.Po
333.Ql /
334is shown here
335.Pc .
336Multiple
337.Fl s
338expressions can be specified.
339The expressions are applied in the order they are specified on the
340command line, terminating with the first successful substitution.
341.Pp
342The optional trailing
343.Cm g
344continues to apply the substitution expression to the pathname substring,
345which starts with the first character following the end of the last successful
346substitution.
347The first unsuccessful substitution stops the operation of the
348.Cm g
349option.
350The optional trailing
351.Cm p
352will cause the final result of a successful substitution to be written to
353standard error in the following format:
354.Pp
355.D1 Em original-pathname No >> Em new-pathname
356.Pp
357File or archive member names that substitute to the empty string
358are not selected and will be skipped.
359.It Fl v
360Verbose operation mode.
361.It Fl w
362Interactively rename files.
363This option causes
364.Nm
365to prompt the user for the filename to use when storing or
366extracting files in an archive.
367.It Fl X
368Do not cross mount points in the file system.
369.It Fl Z
370Compress archive using
371.Xr compress 1 .
372.It Fl z
373Compress archive using
374.Xr gzip 1 .
375.El
376.Pp
377The options
378.Op Fl 014578
379can be used to select one of the compiled-in backup devices,
380.Pa /dev/rstN .
381.Sh ENVIRONMENT
382.Bl -tag -width Fl
383.It Ev TMPDIR
384Path in which to store temporary files.
385.It Ev TAPE
386Default tape device to use instead of
387.Pa /dev/rst0 .
388.El
389.Sh FILES
390.Bl -tag -width "/dev/rst0"
391.It Pa /dev/rst0
392default archive name
393.El
394.Sh EXAMPLES
395Create an archive on the default tape drive, containing the files named
396.Pa bonvole
397and
398.Pa sekve :
399.Pp
400.Dl $ tar c bonvole sekve
401.Pp
402Output a
403.Xr gzip 1
404compressed archive containing the files
405.Pa bonvole
406and
407.Pa sekve
408to a file called
409.Pa foriru.tar.gz :
410.Pp
411.Dl $ tar zcf foriru.tar.gz bonvole sekve
412.Pp
413Verbosely create an archive, called
414.Pa backup.tar.gz ,
415of all files matching the shell
416.Xr glob 3
417function
418.Pa *.c :
419.Pp
420.Dl $ tar zcvf backup.tar.gz *.c
421.Pp
422Verbosely list, but do not extract, all files ending in
423.Pa .jpeg
424from a compressed archive named
425.Pa backup.tar.gz .
426Note that the glob pattern has been quoted to avoid expansion by the shell:
427.Pp
428.Dl $ tar tvzf backup.tar.gz '*.jpeg'
429.Pp
430For more detailed examples, see
431.Xr pax 1 .
432.Sh DIAGNOSTICS
433.Nm
434will exit with one of the following values:
435.Bl -tag -width 2n -offset indent
436.It 0
437All files were processed successfully.
438.It 1
439An error occurred.
440.El
441.Pp
442Whenever
443.Nm
444cannot create a file or a link when extracting an archive or cannot
445find a file while writing an archive, or cannot preserve the user
446ID, group ID, file mode, or access and modification times when the
447.Fl p
448option is specified, a diagnostic message is written to standard
449error and a non-zero exit value will be returned, but processing
450will continue.
451In the case where
452.Nm
453cannot create a link to a file,
454unless
455.Fl M Ar lncp
456is given,
457.Nm
458will not create a second copy of the file.
459.Pp
460If the extraction of a file from an archive is prematurely terminated
461by a signal or error,
462.Nm
463may have only partially extracted the file the user wanted.
464Additionally, the file modes of extracted files and directories may
465have incorrect file bits, and the modification and access times may
466be wrong.
467.Pp
468If the creation of an archive is prematurely terminated by a signal
469or error,
470.Nm
471may have only partially created the archive, which may violate the
472specific archive format specification.
473.Sh SEE ALSO
474.Xr cpio 1 ,
475.Xr pax 1
476.Sh HISTORY
477A
478.Nm
479command first appeared in
480.At v7 .
481.Sh AUTHORS
482Keith Muller at the University of California, San Diego.
483.Sh CAVEATS
484The
485.Fl L
486flag is not portable to other versions of
487.Nm
488where it may have a different meaning.
489The
490.Fl R ,
491.Fl S ,
492and
493.Fl M
494options are extensions specific to
495.Mx .
Note: See TracBrowser for help on using the repository browser.