source: freewrt/tools/paxmirabilis/tar.1@ c6ac237

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

Import paxmirabilis (MirCpio) from CVS as of today:
cvs -d anoncvs@…:/cvs co src/bin/pax

This will be used to replace the dependency on
GNU tar, reduce bugs and add flexibility.

ok wbx@

git-svn-id: svn://www.freewrt.org/trunk/freewrt@203 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 11.0 KB
Line 
1.\" $MirOS: src/bin/pax/tar.1,v 1.6 2006/06/19 20:31:05 tg Exp $
2.\" $OpenBSD: tar.1,v 1.47 2005/05/24 16:33:45 jaredy 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.47 2005/05/24 16:33:45 jaredy Exp $
28.\"
29.Dd February 7, 2001
30.Dt TAR 1
31.Os
32.Sh NAME
33.Nm tar
34.Nd tape archiver
35.Sh SYNOPSIS
36.Nm tar
37.Sm off
38.No { Cm crtux No } Op Cm 014578befHhLmOoPRSpqsvwXZz
39.Sm on
40.Bk -words
41.Op Ar blocking-factor | archive | replstr
42.Op Fl C Ar directory
43.Op Fl I Ar file
44.Op Ar file ...
45.Ek
46.Pp
47.Nm tar
48.No { Ns Fl crtux Ns }
49.Op Fl 014578eHhLmOoPpqvwXZz
50.Op Fl b Ar blocking-factor
51.Op Fl C Ar directory
52.Op Fl f Ar archive
53.Op Fl I Ar file
54.Op Fl M Ar value
55.Op Fl s Ar replstr
56.Op Ar file ...
57.Sh DESCRIPTION
58The
59.Nm
60command creates, adds files to, or extracts files from an
61archive file in
62.Dq tar
63format.
64A tar archive is often stored on a magnetic tape, but can be
65stored equally well on a floppy, CD-ROM, or in a regular disk file.
66.Pp
67In the first (legacy) form, all option flags except for
68.Fl C
69and
70.Fl I
71must be contained within the first argument to
72.Nm
73and must not be prefixed by a hyphen
74.Pq Sq - .
75Option arguments, if any, are processed as subsequent arguments to
76.Nm
77and are processed in the order in which their corresponding option
78flags have been presented on the command line.
79.Pp
80In the second and preferred form, option flags may be given in any order
81and are immediately followed by their corresponding option argument
82values.
83.Pp
84One of the following flags must be present:
85.Bl -tag -width Ds
86.It Fl c
87Create new archive, or overwrite an existing archive,
88adding the specified files to it.
89.It Fl r
90Append the named new files to existing archive.
91Note that this will only work on media on which an end-of-file mark
92can be overwritten.
93.It Fl t
94List contents of archive.
95If any files are named on the
96command line, only those files will be listed.
97The
98.Ar file
99arguments may be specified as glob patterns (see
100.Xr glob 3
101for more information), in which case
102.Nm
103will list all archive members that match each pattern.
104.It Fl u
105Alias for
106.Fl r .
107.It Fl x
108Extract files from archive.
109If any files are named on the
110command line, only those files will be extracted from the
111archive.
112The
113.Ar file
114arguments may be specified as glob patterns (see
115.Xr glob 3
116for more information), in which case
117.Nm
118will extract all archive members that match each pattern.
119.Pp
120If more than one copy of a file exists in the
121archive, later copies will overwrite earlier copies during
122extraction.
123The file mode and modification time are preserved
124if possible.
125The file mode is subject to modification by the
126.Xr umask 2 .
127.El
128.Pp
129In addition to the flags mentioned above, any of the following
130flags may be used:
131.Bl -tag -width Ds
132.It Fl b Ar blocking-factor
133Set blocking factor to use for the archive.
134.Nm
135uses 512-byte blocks.
136The default is 20, the maximum is 126.
137Archives with a blocking factor larger than 63 violate the
138.Tn POSIX
139standard and will not be portable to all systems.
140.It Fl C Ar directory
141This is a positional argument which sets the working directory for the
142following files.
143When extracting, files will be extracted into
144the specified directory; when creating, the specified files will be matched
145from the directory.
146.It Fl e
147Stop after the first error.
148.It Fl f Ar archive
149Filename where the archive is stored.
150Defaults to
151.Pa /dev/rst0 .
152.It Fl H
153Follow symlinks given on the command line only.
154.It Fl h
155Follow symbolic links as if they were normal files
156or directories.
157In extract mode this means that a directory entry in the archive
158will not overwrite an existing symbolic link, but rather what the
159link ultimately points to.
160.It Fl I Ar file
161This is a positional argument which reads the names of files to
162archive or extract from the given file, one per line.
163.It Fl L
164Synonym for the
165.Fl h
166option.
167.It Fl M Ar value
168Configure the archive normaliser.
169.Ar value
170is either a number or a string, optionally prefixed with
171.Dq no-
172to turn the flag off.
173See
174.Xr cpio 1
175for a comprehensive list and compatibility notes.
176.Pp
177.Bl -tag -width xxxxxx -compact
178.It Ar inodes
1790x0001: Serialise inodes, zero device info.
180.It Ar links
1810x0002: Store content of hard links only once.
182.It Ar mtime
1830x0004: Zero out the file modification time.
184.It Ar uidgid
1850x0008: Set owner to 0:0 (root:wheel).
186.El
187.Pp
188This option is only implemented for the cpio, sv4cpio,
189ustar, and sv4crc file format writing routines.
190For the ustar format, the
191.Ar inodes
192and
193.Ar links
194specifiers are ignored.
195.It Fl m
196Do not preserve modification time.
197.It Fl O
198Write old-style (non-POSIX) archives.
199.It Fl o
200Don't write directory information that the older (V7) style
201.Nm
202is unable to decode.
203This implies the
204.Fl O
205flag.
206.It Fl P
207Do not strip leading slashes
208.Pq Sq /
209from pathnames.
210The default is to strip leading slashes.
211.It Fl p
212Preserve user and group ID as well as file mode regardless of
213the current
214.Xr umask 2 .
215The setuid and setgid bits are only preserved if the user is
216the superuser.
217Only meaningful in conjunction with the
218.Fl x
219flag.
220.It Fl q
221Select the first archive member that matches each
222.Ar file
223operand.
224No more than one archive member is matched for each
225.Ar file .
226When members of type directory are matched, the file hierarchy rooted at that
227directory is also matched.
228.It Fl R
229Write SysVR4 CPIO files instead of tar or POSIX ustar files.
230Serialise inode numbers, zero out device information.
231The file content of hard links is stored only once.
232.It Fl S
233Write SysVR4 CPIO files with CRC instead of tar or POSIX ustar files.
234Serialise inode numbers, zero out device information.
235The file content of hard links is stored only once.
236.It Fl s Ar replstr
237Modify the archive member names according to the substitution expression
238.Ar replstr ,
239using the syntax of the
240.Xr ed 1
241utility regular expressions.
242.Ar file
243arguments may be given to restrict the list of archive members to those
244specified.
245.Pp
246The format of these regular expressions is
247.Pp
248.Dl /old/new/[gp]
249.Pp
250As in
251.Xr ed 1 ,
252.Va old
253is a basic regular expression (see
254.Xr re_format 7 )
255and
256.Va new
257can contain an ampersand
258.Pq Ql & ,
259.Ql \e Ns Em n
260(where
261.Em n
262is a digit) back-references,
263or subexpression matching.
264The
265.Va old
266string may also contain newline characters.
267Any non-null character can be used as a delimiter
268.Po
269.Ql /
270is shown here
271.Pc .
272Multiple
273.Fl s
274expressions can be specified.
275The expressions are applied in the order they are specified on the
276command line, terminating with the first successful substitution.
277.Pp
278The optional trailing
279.Cm g
280continues to apply the substitution expression to the pathname substring,
281which starts with the first character following the end of the last successful
282substitution.
283The first unsuccessful substitution stops the operation of the
284.Cm g
285option.
286The optional trailing
287.Cm p
288will cause the final result of a successful substitution to be written to
289standard error in the following format:
290.Pp
291.D1 Em original-pathname No >> Em new-pathname
292.Pp
293File or archive member names that substitute to the empty string
294are not selected and will be skipped.
295.It Fl v
296Verbose operation mode.
297.It Fl w
298Interactively rename files.
299This option causes
300.Nm
301to prompt the user for the filename to use when storing or
302extracting files in an archive.
303.It Fl X
304Do not cross mount points in the file system.
305.It Fl Z
306Compress archive using
307.Xr compress 1 .
308.It Fl z
309Compress archive using
310.Xr gzip 1 .
311.El
312.Pp
313The options
314.Op Fl 014578
315can be used to select one of the compiled-in backup devices,
316.Pa /dev/rstN .
317.Sh ENVIRONMENT
318.Bl -tag -width Fl
319.It Ev TMPDIR
320Path in which to store temporary files.
321.It Ev TAPE
322Default tape device to use instead of
323.Pa /dev/rst0 .
324.El
325.Sh FILES
326.Bl -tag -width "/dev/rst0"
327.It Pa /dev/rst0
328default archive name
329.El
330.Sh EXAMPLES
331Create an archive on the default tape drive, containing the files named
332.Pa bonvole
333and
334.Pa sekve :
335.Pp
336.Dl $ tar c bonvole sekve
337.Pp
338Output a
339.Xr gzip 1
340compressed archive containing the files
341.Pa bonvole
342and
343.Pa sekve
344to a file called
345.Pa foriru.tar.gz :
346.Pp
347.Dl $ tar zcf foriru.tar.gz bonvole sekve
348.Pp
349Verbosely create an archive, called
350.Pa backup.tar.gz ,
351of all files matching the shell
352.Xr glob 3
353function
354.Pa *.c :
355.Pp
356.Dl $ tar zcvf backup.tar.gz *.c
357.Pp
358Verbosely list, but do not extract, all files ending in
359.Pa .jpeg
360from a compressed archive named
361.Pa backup.tar.gz .
362Note that the glob pattern has been quoted to avoid expansion by the shell:
363.Pp
364.Dl $ tar tvzf backup.tar.gz '*.jpeg'
365.Pp
366For more detailed examples, see
367.Xr pax 1 .
368.Sh DIAGNOSTICS
369.Nm
370will exit with one of the following values:
371.Bl -tag -width 2n -offset indent
372.It 0
373All files were processed successfully.
374.It 1
375An error occurred.
376.El
377.Pp
378Whenever
379.Nm
380cannot create a file or a link when extracting an archive or cannot
381find a file while writing an archive, or cannot preserve the user
382ID, group ID, file mode, or access and modification times when the
383.Fl p
384option is specified, a diagnostic message is written to standard
385error and a non-zero exit value will be returned, but processing
386will continue.
387In the case where
388.Nm
389cannot create a link to a file,
390.Nm
391will not create a second copy of the file.
392.Pp
393If the extraction of a file from an archive is prematurely terminated
394by a signal or error,
395.Nm
396may have only partially extracted the file the user wanted.
397Additionally, the file modes of extracted files and directories may
398have incorrect file bits, and the modification and access times may
399be wrong.
400.Pp
401If the creation of an archive is prematurely terminated by a signal
402or error,
403.Nm
404may have only partially created the archive, which may violate the
405specific archive format specification.
406.Sh SEE ALSO
407.Xr cpio 1 ,
408.Xr pax 1
409.Sh HISTORY
410A
411.Nm
412command first appeared in
413.At v7 .
414.Sh AUTHORS
415Keith Muller at the University of California, San Diego.
416.Sh CAVEATS
417The
418.Fl L
419flag is not portable to other versions of
420.Nm
421where it may have a different meaning.
422The
423.Fl R ,
424.Fl S ,
425and
426.Fl M
427options are extensions specific to
428.Mx .
Note: See TracBrowser for help on using the repository browser.