xref: /minix3/external/bsd/libarchive/dist/tar/bsdtar.1 (revision 543adbed3a3a783ed36434adafbc258b6bde442d)
1*543adbedSBen Gras.\" Copyright (c) 2003-2007 Tim Kientzle
2*543adbedSBen Gras.\" All rights reserved.
3*543adbedSBen Gras.\"
4*543adbedSBen Gras.\" Redistribution and use in source and binary forms, with or without
5*543adbedSBen Gras.\" modification, are permitted provided that the following conditions
6*543adbedSBen Gras.\" are met:
7*543adbedSBen Gras.\" 1. Redistributions of source code must retain the above copyright
8*543adbedSBen Gras.\"    notice, this list of conditions and the following disclaimer.
9*543adbedSBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
10*543adbedSBen Gras.\"    notice, this list of conditions and the following disclaimer in the
11*543adbedSBen Gras.\"    documentation and/or other materials provided with the distribution.
12*543adbedSBen Gras.\"
13*543adbedSBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*543adbedSBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*543adbedSBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*543adbedSBen Gras.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*543adbedSBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*543adbedSBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*543adbedSBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*543adbedSBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*543adbedSBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*543adbedSBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*543adbedSBen Gras.\" SUCH DAMAGE.
24*543adbedSBen Gras.\"
25*543adbedSBen Gras.\" $FreeBSD: src/usr.bin/tar/bsdtar.1,v 1.46 2008/12/06 07:37:55 kientzle Exp $
26*543adbedSBen Gras.\"
27*543adbedSBen Gras.Dd Oct 12, 2009
28*543adbedSBen Gras.Dt BSDTAR 1
29*543adbedSBen Gras.Os
30*543adbedSBen Gras.Sh NAME
31*543adbedSBen Gras.Nm tar
32*543adbedSBen Gras.Nd manipulate tape archives
33*543adbedSBen Gras.Sh SYNOPSIS
34*543adbedSBen Gras.Nm
35*543adbedSBen Gras.Op Ar bundled-flags Ao args Ac
36*543adbedSBen Gras.Op Ao Ar file Ac | Ao Ar pattern Ac ...
37*543adbedSBen Gras.Nm
38*543adbedSBen Gras.Brq Fl c
39*543adbedSBen Gras.Op Ar options
40*543adbedSBen Gras.Op Ar files | Ar directories
41*543adbedSBen Gras.Nm
42*543adbedSBen Gras.Brq Fl r | Fl u
43*543adbedSBen Gras.Fl f Ar archive-file
44*543adbedSBen Gras.Op Ar options
45*543adbedSBen Gras.Op Ar files | Ar directories
46*543adbedSBen Gras.Nm
47*543adbedSBen Gras.Brq Fl t | Fl x
48*543adbedSBen Gras.Op Ar options
49*543adbedSBen Gras.Op Ar patterns
50*543adbedSBen Gras.Sh DESCRIPTION
51*543adbedSBen Gras.Nm
52*543adbedSBen Grascreates and manipulates streaming archive files.
53*543adbedSBen GrasThis implementation can extract from tar, pax, cpio, zip, jar, ar,
54*543adbedSBen Grasand ISO 9660 cdrom images and can create tar, pax, cpio, ar,
55*543adbedSBen Grasand shar archives.
56*543adbedSBen Gras.Pp
57*543adbedSBen GrasThe first synopsis form shows a
58*543adbedSBen Gras.Dq bundled
59*543adbedSBen Grasoption word.
60*543adbedSBen GrasThis usage is provided for compatibility with historical implementations.
61*543adbedSBen GrasSee COMPATIBILITY below for details.
62*543adbedSBen Gras.Pp
63*543adbedSBen GrasThe other synopsis forms show the preferred usage.
64*543adbedSBen GrasThe first option to
65*543adbedSBen Gras.Nm
66*543adbedSBen Grasis a mode indicator from the following list:
67*543adbedSBen Gras.Bl -tag -compact -width indent
68*543adbedSBen Gras.It Fl c
69*543adbedSBen GrasCreate a new archive containing the specified items.
70*543adbedSBen Gras.It Fl r
71*543adbedSBen GrasLike
72*543adbedSBen Gras.Fl c ,
73*543adbedSBen Grasbut new entries are appended to the archive.
74*543adbedSBen GrasNote that this only works on uncompressed archives stored in regular files.
75*543adbedSBen GrasThe
76*543adbedSBen Gras.Fl f
77*543adbedSBen Grasoption is required.
78*543adbedSBen Gras.It Fl t
79*543adbedSBen GrasList archive contents to stdout.
80*543adbedSBen Gras.It Fl u
81*543adbedSBen GrasLike
82*543adbedSBen Gras.Fl r ,
83*543adbedSBen Grasbut new entries are added only if they have a modification date
84*543adbedSBen Grasnewer than the corresponding entry in the archive.
85*543adbedSBen GrasNote that this only works on uncompressed archives stored in regular files.
86*543adbedSBen GrasThe
87*543adbedSBen Gras.Fl f
88*543adbedSBen Grasoption is required.
89*543adbedSBen Gras.It Fl x
90*543adbedSBen GrasExtract to disk from the archive.
91*543adbedSBen GrasIf a file with the same name appears more than once in the archive,
92*543adbedSBen Graseach copy will be extracted, with later copies overwriting (replacing)
93*543adbedSBen Grasearlier copies.
94*543adbedSBen Gras.El
95*543adbedSBen Gras.Pp
96*543adbedSBen GrasIn
97*543adbedSBen Gras.Fl c ,
98*543adbedSBen Gras.Fl r ,
99*543adbedSBen Grasor
100*543adbedSBen Gras.Fl u
101*543adbedSBen Grasmode, each specified file or directory is added to the
102*543adbedSBen Grasarchive in the order specified on the command line.
103*543adbedSBen GrasBy default, the contents of each directory are also archived.
104*543adbedSBen Gras.Pp
105*543adbedSBen GrasIn extract or list mode, the entire command line
106*543adbedSBen Grasis read and parsed before the archive is opened.
107*543adbedSBen GrasThe pathnames or patterns on the command line indicate
108*543adbedSBen Graswhich items in the archive should be processed.
109*543adbedSBen GrasPatterns are shell-style globbing patterns as
110*543adbedSBen Grasdocumented in
111*543adbedSBen Gras.Xr tcsh 1 .
112*543adbedSBen Gras.Sh OPTIONS
113*543adbedSBen GrasUnless specifically stated otherwise, options are applicable in
114*543adbedSBen Grasall operating modes.
115*543adbedSBen Gras.Bl -tag -width indent
116*543adbedSBen Gras.It Cm @ Ns Pa archive
117*543adbedSBen Gras(c and r mode only)
118*543adbedSBen GrasThe specified archive is opened and the entries
119*543adbedSBen Grasin it will be appended to the current archive.
120*543adbedSBen GrasAs a simple example,
121*543adbedSBen Gras.Dl Nm Fl c Fl f Pa - Pa newfile Cm @ Ns Pa original.tar
122*543adbedSBen Graswrites a new archive to standard output containing a file
123*543adbedSBen Gras.Pa newfile
124*543adbedSBen Grasand all of the entries from
125*543adbedSBen Gras.Pa original.tar .
126*543adbedSBen GrasIn contrast,
127*543adbedSBen Gras.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
128*543adbedSBen Grascreates a new archive with only two entries.
129*543adbedSBen GrasSimilarly,
130*543adbedSBen Gras.Dl Nm Fl czf Pa - Fl -format Cm pax Cm @ Ns Pa -
131*543adbedSBen Grasreads an archive from standard input (whose format will be determined
132*543adbedSBen Grasautomatically) and converts it into a gzip-compressed
133*543adbedSBen Graspax-format archive on stdout.
134*543adbedSBen GrasIn this way,
135*543adbedSBen Gras.Nm
136*543adbedSBen Grascan be used to convert archives from one format to another.
137*543adbedSBen Gras.It Fl b Ar blocksize
138*543adbedSBen GrasSpecify the block size, in 512-byte records, for tape drive I/O.
139*543adbedSBen GrasAs a rule, this argument is only needed when reading from or writing
140*543adbedSBen Grasto tape drives, and usually not even then as the default block size of
141*543adbedSBen Gras20 records (10240 bytes) is very common.
142*543adbedSBen Gras.It Fl C Ar directory
143*543adbedSBen GrasIn c and r mode, this changes the directory before adding
144*543adbedSBen Grasthe following files.
145*543adbedSBen GrasIn x mode, change directories after opening the archive
146*543adbedSBen Grasbut before extracting entries from the archive.
147*543adbedSBen Gras.It Fl -check-links
148*543adbedSBen Gras(c and r modes only)
149*543adbedSBen GrasIssue a warning message unless all links to each file are archived.
150*543adbedSBen Gras.It Fl -chroot
151*543adbedSBen Gras(x mode only)
152*543adbedSBen Gras.Fn chroot
153*543adbedSBen Grasto the current directory after processing any
154*543adbedSBen Gras.Fl C
155*543adbedSBen Grasoptions and before extracting any files.
156*543adbedSBen Gras.It Fl -exclude Ar pattern
157*543adbedSBen GrasDo not process files or directories that match the
158*543adbedSBen Grasspecified pattern.
159*543adbedSBen GrasNote that exclusions take precedence over patterns or filenames
160*543adbedSBen Grasspecified on the command line.
161*543adbedSBen Gras.It Fl -format Ar format
162*543adbedSBen Gras(c, r, u mode only)
163*543adbedSBen GrasUse the specified format for the created archive.
164*543adbedSBen GrasSupported formats include
165*543adbedSBen Gras.Dq cpio ,
166*543adbedSBen Gras.Dq pax ,
167*543adbedSBen Gras.Dq shar ,
168*543adbedSBen Grasand
169*543adbedSBen Gras.Dq ustar .
170*543adbedSBen GrasOther formats may also be supported; see
171*543adbedSBen Gras.Xr libarchive-formats 5
172*543adbedSBen Grasfor more information about currently-supported formats.
173*543adbedSBen GrasIn r and u modes, when extending an existing archive, the format specified
174*543adbedSBen Grashere must be compatible with the format of the existing archive on disk.
175*543adbedSBen Gras.It Fl f Ar file
176*543adbedSBen GrasRead the archive from or write the archive to the specified file.
177*543adbedSBen GrasThe filename can be
178*543adbedSBen Gras.Pa -
179*543adbedSBen Grasfor standard input or standard output.
180*543adbedSBen GrasIf not specified, the default tape device will be used.
181*543adbedSBen Gras(On
182*543adbedSBen Gras.Fx ,
183*543adbedSBen Grasthe default tape device is
184*543adbedSBen Gras.Pa /dev/sa0 . )
185*543adbedSBen Gras.It Fl H
186*543adbedSBen Gras(c and r mode only)
187*543adbedSBen GrasSymbolic links named on the command line will be followed; the
188*543adbedSBen Grastarget of the link will be archived, not the link itself.
189*543adbedSBen Gras.It Fl h
190*543adbedSBen Gras(c and r mode only)
191*543adbedSBen GrasSynonym for
192*543adbedSBen Gras.Fl L .
193*543adbedSBen Gras.It Fl I
194*543adbedSBen GrasSynonym for
195*543adbedSBen Gras.Fl T .
196*543adbedSBen Gras.It Fl -include Ar pattern
197*543adbedSBen GrasProcess only files or directories that match the specified pattern.
198*543adbedSBen GrasNote that exclusions specified with
199*543adbedSBen Gras.Fl -exclude
200*543adbedSBen Grastake precedence over inclusions.
201*543adbedSBen GrasIf no inclusions are explicitly specified, all entries are processed by
202*543adbedSBen Grasdefault.
203*543adbedSBen GrasThe
204*543adbedSBen Gras.Fl -include
205*543adbedSBen Grasoption is especially useful when filtering archives.
206*543adbedSBen GrasFor example, the command
207*543adbedSBen Gras.Dl Nm Fl c Fl f Pa new.tar Fl -include='*foo*' Cm @ Ns Pa old.tgz
208*543adbedSBen Grascreates a new archive
209*543adbedSBen Gras.Pa new.tar
210*543adbedSBen Grascontaining only the entries from
211*543adbedSBen Gras.Pa old.tgz
212*543adbedSBen Grascontaining the string
213*543adbedSBen Gras.Sq foo .
214*543adbedSBen Gras.It Fl j
215*543adbedSBen Gras(c mode only)
216*543adbedSBen GrasCompress the resulting archive with
217*543adbedSBen Gras.Xr bzip2 1 .
218*543adbedSBen GrasIn extract or list modes, this option is ignored.
219*543adbedSBen GrasNote that, unlike other
220*543adbedSBen Gras.Nm tar
221*543adbedSBen Grasimplementations, this implementation recognizes bzip2 compression
222*543adbedSBen Grasautomatically when reading archives.
223*543adbedSBen Gras.It Fl k
224*543adbedSBen Gras(x mode only)
225*543adbedSBen GrasDo not overwrite existing files.
226*543adbedSBen GrasIn particular, if a file appears more than once in an archive,
227*543adbedSBen Graslater copies will not overwrite earlier copies.
228*543adbedSBen Gras.It Fl -keep-newer-files
229*543adbedSBen Gras(x mode only)
230*543adbedSBen GrasDo not overwrite existing files that are newer than the
231*543adbedSBen Grasversions appearing in the archive being extracted.
232*543adbedSBen Gras.It Fl L
233*543adbedSBen Gras(c and r mode only)
234*543adbedSBen GrasAll symbolic links will be followed.
235*543adbedSBen GrasNormally, symbolic links are archived as such.
236*543adbedSBen GrasWith this option, the target of the link will be archived instead.
237*543adbedSBen Gras.It Fl l
238*543adbedSBen GrasThis is a synonym for the
239*543adbedSBen Gras.Fl -check-links
240*543adbedSBen Grasoption.
241*543adbedSBen Gras.It Fl m
242*543adbedSBen Gras(x mode only)
243*543adbedSBen GrasDo not extract modification time.
244*543adbedSBen GrasBy default, the modification time is set to the time stored in the archive.
245*543adbedSBen Gras.It Fl n
246*543adbedSBen Gras(c, r, u modes only)
247*543adbedSBen GrasDo not recursively archive the contents of directories.
248*543adbedSBen Gras.It Fl -newer Ar date
249*543adbedSBen Gras(c, r, u modes only)
250*543adbedSBen GrasOnly include files and directories newer than the specified date.
251*543adbedSBen GrasThis compares ctime entries.
252*543adbedSBen Gras.It Fl -newer-mtime Ar date
253*543adbedSBen Gras(c, r, u modes only)
254*543adbedSBen GrasLike
255*543adbedSBen Gras.Fl -newer ,
256*543adbedSBen Grasexcept it compares mtime entries instead of ctime entries.
257*543adbedSBen Gras.It Fl -newer-than Pa file
258*543adbedSBen Gras(c, r, u modes only)
259*543adbedSBen GrasOnly include files and directories newer than the specified file.
260*543adbedSBen GrasThis compares ctime entries.
261*543adbedSBen Gras.It Fl -newer-mtime-than Pa file
262*543adbedSBen Gras(c, r, u modes only)
263*543adbedSBen GrasLike
264*543adbedSBen Gras.Fl -newer-than ,
265*543adbedSBen Grasexcept it compares mtime entries instead of ctime entries.
266*543adbedSBen Gras.It Fl -nodump
267*543adbedSBen Gras(c and r modes only)
268*543adbedSBen GrasHonor the nodump file flag by skipping this file.
269*543adbedSBen Gras.It Fl -null
270*543adbedSBen Gras(use with
271*543adbedSBen Gras.Fl I ,
272*543adbedSBen Gras.Fl T ,
273*543adbedSBen Grasor
274*543adbedSBen Gras.Fl X )
275*543adbedSBen GrasFilenames or patterns are separated by null characters,
276*543adbedSBen Grasnot by newlines.
277*543adbedSBen GrasThis is often used to read filenames output by the
278*543adbedSBen Gras.Fl print0
279*543adbedSBen Grasoption to
280*543adbedSBen Gras.Xr find 1 .
281*543adbedSBen Gras.It Fl -numeric-owner
282*543adbedSBen Gras(x mode only)
283*543adbedSBen GrasIgnore symbolic user and group names when restoring archives to disk,
284*543adbedSBen Grasonly numeric uid and gid values will be obeyed.
285*543adbedSBen Gras.It Fl O
286*543adbedSBen Gras(x, t modes only)
287*543adbedSBen GrasIn extract (-x) mode, files will be written to standard out rather than
288*543adbedSBen Grasbeing extracted to disk.
289*543adbedSBen GrasIn list (-t) mode, the file listing will be written to stderr rather than
290*543adbedSBen Grasthe usual stdout.
291*543adbedSBen Gras.It Fl o
292*543adbedSBen Gras(x mode)
293*543adbedSBen GrasUse the user and group of the user running the program rather
294*543adbedSBen Grasthan those specified in the archive.
295*543adbedSBen GrasNote that this has no significance unless
296*543adbedSBen Gras.Fl p
297*543adbedSBen Grasis specified, and the program is being run by the root user.
298*543adbedSBen GrasIn this case, the file modes and flags from
299*543adbedSBen Grasthe archive will be restored, but ACLs or owner information in
300*543adbedSBen Grasthe archive will be discarded.
301*543adbedSBen Gras.It Fl o
302*543adbedSBen Gras(c, r, u mode)
303*543adbedSBen GrasA synonym for
304*543adbedSBen Gras.Fl -format Ar ustar
305*543adbedSBen Gras.It Fl -one-file-system
306*543adbedSBen Gras(c, r, and u modes)
307*543adbedSBen GrasDo not cross mount points.
308*543adbedSBen Gras.It Fl -options Ar options
309*543adbedSBen GrasSelect optional behaviors for particular modules.
310*543adbedSBen GrasThe argument is a text string containing comma-separated
311*543adbedSBen Graskeywords and values.
312*543adbedSBen GrasThese are passed to the modules that handle particular
313*543adbedSBen Grasformats to control how those formats will behave.
314*543adbedSBen GrasEach option has one of the following forms:
315*543adbedSBen Gras.Bl -tag -compact -width indent
316*543adbedSBen Gras.It Ar key=value
317*543adbedSBen GrasThe key will be set to the specified value in every module that supports it.
318*543adbedSBen GrasModules that do not support this key will ignore it.
319*543adbedSBen Gras.It Ar key
320*543adbedSBen GrasThe key will be enabled in every module that supports it.
321*543adbedSBen GrasThis is equivalent to
322*543adbedSBen Gras.Ar key Ns Cm =1 .
323*543adbedSBen Gras.It Ar !key
324*543adbedSBen GrasThe key will be disabled in every module that supports it.
325*543adbedSBen Gras.It Ar module:key=value , Ar module:key , Ar module:!key
326*543adbedSBen GrasAs above, but the corresponding key and value will be provided
327*543adbedSBen Grasonly to modules whose name matches
328*543adbedSBen Gras.Ar module .
329*543adbedSBen Gras.El
330*543adbedSBen GrasThe currently supported modules and keys are:
331*543adbedSBen Gras.Bl -tag -compact -width indent
332*543adbedSBen Gras.It Cm iso9660:joliet
333*543adbedSBen GrasSupport Joliet extensions.
334*543adbedSBen GrasThis is enabled by default, use
335*543adbedSBen Gras.Cm !joliet
336*543adbedSBen Grasor
337*543adbedSBen Gras.Cm iso9660:!joliet
338*543adbedSBen Grasto disable.
339*543adbedSBen Gras.It Cm iso9660:rockridge
340*543adbedSBen GrasSupport Rock Ridge extensions.
341*543adbedSBen GrasThis is enabled by default, use
342*543adbedSBen Gras.Cm !rockridge
343*543adbedSBen Grasor
344*543adbedSBen Gras.Cm iso9660:!rockridge
345*543adbedSBen Grasto disable.
346*543adbedSBen Gras.It Cm gzip:compression-level
347*543adbedSBen GrasA decimal integer from 0 to 9 specifying the gzip compression level.
348*543adbedSBen Gras.It Cm xz:compression-level
349*543adbedSBen GrasA decimal integer from 0 to 9 specifying the xz compression level.
350*543adbedSBen Gras.It Cm mtree: Ns Ar keyword
351*543adbedSBen GrasThe mtree writer module allows you to specify which mtree keywords
352*543adbedSBen Graswill be included in the output.
353*543adbedSBen GrasSupported keywords include:
354*543adbedSBen Gras.Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent ,
355*543adbedSBen Gras.Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 ,
356*543adbedSBen Gras.Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname .
357*543adbedSBen GrasThe default is equivalent to:
358*543adbedSBen Gras.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
359*543adbedSBen Gras.It Cm mtree:all
360*543adbedSBen GrasEnables all of the above keywords.
361*543adbedSBen GrasYou can also use
362*543adbedSBen Gras.Cm mtree:!all
363*543adbedSBen Grasto disable all keywords.
364*543adbedSBen Gras.It Cm mtree:use-set
365*543adbedSBen GrasEnable generation of
366*543adbedSBen Gras.Cm /set
367*543adbedSBen Graslines in the output.
368*543adbedSBen Gras.It Cm mtree:indent
369*543adbedSBen GrasProduce human-readable output by indenting options and splitting lines
370*543adbedSBen Grasto fit into 80 columns.
371*543adbedSBen Gras.It Cm zip:compression Ns = Ns Ar type
372*543adbedSBen GrasUse
373*543adbedSBen Gras.Ar type
374*543adbedSBen Grasas compression method.
375*543adbedSBen GrasSupported values are store (uncompressed) and deflate (gzip algorithm).
376*543adbedSBen Gras.El
377*543adbedSBen GrasIf a provided option is not supported by any module, that
378*543adbedSBen Grasis a fatal error.
379*543adbedSBen Gras.It Fl P
380*543adbedSBen GrasPreserve pathnames.
381*543adbedSBen GrasBy default, absolute pathnames (those that begin with a /
382*543adbedSBen Grascharacter) have the leading slash removed both when creating archives
383*543adbedSBen Grasand extracting from them.
384*543adbedSBen GrasAlso,
385*543adbedSBen Gras.Nm
386*543adbedSBen Graswill refuse to extract archive entries whose pathnames contain
387*543adbedSBen Gras.Pa ..
388*543adbedSBen Grasor whose target directory would be altered by a symlink.
389*543adbedSBen GrasThis option suppresses these behaviors.
390*543adbedSBen Gras.It Fl p
391*543adbedSBen Gras(x mode only)
392*543adbedSBen GrasPreserve file permissions.
393*543adbedSBen GrasAttempt to restore the full permissions, including owner, file modes, file
394*543adbedSBen Grasflags and ACLs, if available, for each item extracted from the archive.
395*543adbedSBen GrasBy default, newly-created files are owned by the user running
396*543adbedSBen Gras.Nm ,
397*543adbedSBen Grasthe file mode is restored for newly-created regular files, and
398*543adbedSBen Grasall other types of entries receive default permissions.
399*543adbedSBen GrasIf
400*543adbedSBen Gras.Nm
401*543adbedSBen Grasis being run by root, the default is to restore the owner unless the
402*543adbedSBen Gras.Fl o
403*543adbedSBen Grasoption is also specified.
404*543adbedSBen Gras.It Fl q ( Fl -fast-read )
405*543adbedSBen Gras(x and t mode only)
406*543adbedSBen GrasExtract or list only the first archive entry that matches each pattern
407*543adbedSBen Grasor filename operand.
408*543adbedSBen GrasExit as soon as each specified pattern or filename has been matched.
409*543adbedSBen GrasBy default, the archive is always read to the very end, since
410*543adbedSBen Grasthere can be multiple entries with the same name and, by convention,
411*543adbedSBen Graslater entries overwrite earlier entries.
412*543adbedSBen GrasThis option is provided as a performance optimization.
413*543adbedSBen Gras.It Fl S
414*543adbedSBen Gras(x mode only)
415*543adbedSBen GrasExtract files as sparse files.
416*543adbedSBen GrasFor every block on disk, check first if it contains only NULL bytes and seek
417*543adbedSBen Grasover it otherwise.
418*543adbedSBen GrasThis works similiar to the conv=sparse option of dd.
419*543adbedSBen Gras.It Fl -strip-components Ar count
420*543adbedSBen Gras(x mode only)
421*543adbedSBen GrasRemove the specified number of leading path elements.
422*543adbedSBen GrasPathnames with fewer elements will be silently skipped.
423*543adbedSBen GrasNote that the pathname is edited after checking inclusion/exclusion patterns
424*543adbedSBen Grasbut before security checks.
425*543adbedSBen Gras.It Fl s Ar pattern
426*543adbedSBen GrasModify file or archive member names according to
427*543adbedSBen Gras.Pa pattern .
428*543adbedSBen GrasThe pattern has the format
429*543adbedSBen Gras.Ar /old/new/ Ns Op gps
430*543adbedSBen Graswhere
431*543adbedSBen Gras.Ar old
432*543adbedSBen Grasis a basic regular expression,
433*543adbedSBen Gras.Ar new
434*543adbedSBen Grasis the replacement string of the matched part,
435*543adbedSBen Grasand the optional trailing letters modify
436*543adbedSBen Grashow the replacement is handled.
437*543adbedSBen GrasIf
438*543adbedSBen Gras.Ar old
439*543adbedSBen Grasis not matched, the pattern is skipped.
440*543adbedSBen GrasWithin
441*543adbedSBen Gras.Ar new ,
442*543adbedSBen Gras~ is substituted with the match, \e1 to \e9 with the content of
443*543adbedSBen Grasthe corresponding captured group.
444*543adbedSBen GrasThe optional trailing g specifies that matching should continue
445*543adbedSBen Grasafter the matched part and stopped on the first unmatched pattern.
446*543adbedSBen GrasThe optional trailing s specifies that the pattern applies to the value
447*543adbedSBen Grasof symbolic links.
448*543adbedSBen GrasThe optional trailing p specifies that after a successful substitution
449*543adbedSBen Grasthe original path name and the new path name should be printed to
450*543adbedSBen Grasstandard error.
451*543adbedSBen Gras.It Fl T Ar filename
452*543adbedSBen GrasIn x or t mode,
453*543adbedSBen Gras.Nm
454*543adbedSBen Graswill read the list of names to be extracted from
455*543adbedSBen Gras.Pa filename .
456*543adbedSBen GrasIn c mode,
457*543adbedSBen Gras.Nm
458*543adbedSBen Graswill read names to be archived from
459*543adbedSBen Gras.Pa filename .
460*543adbedSBen GrasThe special name
461*543adbedSBen Gras.Dq -C
462*543adbedSBen Grason a line by itself will cause the current directory to be changed to
463*543adbedSBen Grasthe directory specified on the following line.
464*543adbedSBen GrasNames are terminated by newlines unless
465*543adbedSBen Gras.Fl -null
466*543adbedSBen Grasis specified.
467*543adbedSBen GrasNote that
468*543adbedSBen Gras.Fl -null
469*543adbedSBen Grasalso disables the special handling of lines containing
470*543adbedSBen Gras.Dq -C .
471*543adbedSBen Gras.It Fl U
472*543adbedSBen Gras(x mode only)
473*543adbedSBen GrasUnlink files before creating them.
474*543adbedSBen GrasWithout this option,
475*543adbedSBen Gras.Nm
476*543adbedSBen Grasoverwrites existing files, which preserves existing hardlinks.
477*543adbedSBen GrasWith this option, existing hardlinks will be broken, as will any
478*543adbedSBen Grassymlink that would affect the location of an extracted file.
479*543adbedSBen Gras.It Fl -use-compress-program Ar program
480*543adbedSBen GrasPipe the input (in x or t mode) or the output (in c mode) through
481*543adbedSBen Gras.Pa program
482*543adbedSBen Grasinstead of using the builtin compression support.
483*543adbedSBen Gras.It Fl v
484*543adbedSBen GrasProduce verbose output.
485*543adbedSBen GrasIn create and extract modes,
486*543adbedSBen Gras.Nm
487*543adbedSBen Graswill list each file name as it is read from or written to
488*543adbedSBen Grasthe archive.
489*543adbedSBen GrasIn list mode,
490*543adbedSBen Gras.Nm
491*543adbedSBen Graswill produce output similar to that of
492*543adbedSBen Gras.Xr ls 1 .
493*543adbedSBen GrasAdditional
494*543adbedSBen Gras.Fl v
495*543adbedSBen Grasoptions will provide additional detail.
496*543adbedSBen Gras.It Fl -version
497*543adbedSBen GrasPrint version of
498*543adbedSBen Gras.Nm
499*543adbedSBen Grasand
500*543adbedSBen Gras.Nm libarchive ,
501*543adbedSBen Grasand exit.
502*543adbedSBen Gras.It Fl w
503*543adbedSBen GrasAsk for confirmation for every action.
504*543adbedSBen Gras.It Fl X Ar filename
505*543adbedSBen GrasRead a list of exclusion patterns from the specified file.
506*543adbedSBen GrasSee
507*543adbedSBen Gras.Fl -exclude
508*543adbedSBen Grasfor more information about the handling of exclusions.
509*543adbedSBen Gras.It Fl y
510*543adbedSBen Gras(c mode only)
511*543adbedSBen GrasCompress the resulting archive with
512*543adbedSBen Gras.Xr bzip2 1 .
513*543adbedSBen GrasIn extract or list modes, this option is ignored.
514*543adbedSBen GrasNote that, unlike other
515*543adbedSBen Gras.Nm tar
516*543adbedSBen Grasimplementations, this implementation recognizes bzip2 compression
517*543adbedSBen Grasautomatically when reading archives.
518*543adbedSBen Gras.It Fl z
519*543adbedSBen Gras(c mode only)
520*543adbedSBen GrasCompress the resulting archive with
521*543adbedSBen Gras.Xr gzip 1 .
522*543adbedSBen GrasIn extract or list modes, this option is ignored.
523*543adbedSBen GrasNote that, unlike other
524*543adbedSBen Gras.Nm tar
525*543adbedSBen Grasimplementations, this implementation recognizes gzip compression
526*543adbedSBen Grasautomatically when reading archives.
527*543adbedSBen Gras.It Fl Z
528*543adbedSBen Gras(c mode only)
529*543adbedSBen GrasCompress the resulting archive with
530*543adbedSBen Gras.Xr compress 1 .
531*543adbedSBen GrasIn extract or list modes, this option is ignored.
532*543adbedSBen GrasNote that, unlike other
533*543adbedSBen Gras.Nm tar
534*543adbedSBen Grasimplementations, this implementation recognizes compress compression
535*543adbedSBen Grasautomatically when reading archives.
536*543adbedSBen Gras.El
537*543adbedSBen Gras.Sh EXIT STATUS
538*543adbedSBen Gras.Ex -std
539*543adbedSBen Gras.Sh ENVIRONMENT
540*543adbedSBen GrasThe following environment variables affect the execution of
541*543adbedSBen Gras.Nm :
542*543adbedSBen Gras.Bl -tag -width ".Ev BLOCKSIZE"
543*543adbedSBen Gras.It Ev LANG
544*543adbedSBen GrasThe locale to use.
545*543adbedSBen GrasSee
546*543adbedSBen Gras.Xr environ 7
547*543adbedSBen Grasfor more information.
548*543adbedSBen Gras.It Ev TAPE
549*543adbedSBen GrasThe default tape device.
550*543adbedSBen GrasThe
551*543adbedSBen Gras.Fl f
552*543adbedSBen Grasoption overrides this.
553*543adbedSBen Gras.It Ev TZ
554*543adbedSBen GrasThe timezone to use when displaying dates.
555*543adbedSBen GrasSee
556*543adbedSBen Gras.Xr environ 7
557*543adbedSBen Grasfor more information.
558*543adbedSBen Gras.El
559*543adbedSBen Gras.Sh FILES
560*543adbedSBen Gras.Bl -tag -width ".Ev BLOCKSIZE"
561*543adbedSBen Gras.It Pa /dev/sa0
562*543adbedSBen GrasThe default tape device, if not overridden by the
563*543adbedSBen Gras.Ev TAPE
564*543adbedSBen Grasenvironment variable or the
565*543adbedSBen Gras.Fl f
566*543adbedSBen Grasoption.
567*543adbedSBen Gras.El
568*543adbedSBen Gras.Sh EXAMPLES
569*543adbedSBen GrasThe following creates a new archive
570*543adbedSBen Grascalled
571*543adbedSBen Gras.Ar file.tar.gz
572*543adbedSBen Grasthat contains two files
573*543adbedSBen Gras.Ar source.c
574*543adbedSBen Grasand
575*543adbedSBen Gras.Ar source.h :
576*543adbedSBen Gras.Dl Nm Fl czf Pa file.tar.gz Pa source.c Pa source.h
577*543adbedSBen Gras.Pp
578*543adbedSBen GrasTo view a detailed table of contents for this
579*543adbedSBen Grasarchive:
580*543adbedSBen Gras.Dl Nm Fl tvf Pa file.tar.gz
581*543adbedSBen Gras.Pp
582*543adbedSBen GrasTo extract all entries from the archive on
583*543adbedSBen Grasthe default tape drive:
584*543adbedSBen Gras.Dl Nm Fl x
585*543adbedSBen Gras.Pp
586*543adbedSBen GrasTo examine the contents of an ISO 9660 cdrom image:
587*543adbedSBen Gras.Dl Nm Fl tf Pa image.iso
588*543adbedSBen Gras.Pp
589*543adbedSBen GrasTo move file hierarchies, invoke
590*543adbedSBen Gras.Nm
591*543adbedSBen Grasas
592*543adbedSBen Gras.Dl Nm Fl cf Pa - Fl C Pa srcdir\ . | Nm Fl xpf Pa - Fl C Pa destdir
593*543adbedSBen Grasor more traditionally
594*543adbedSBen Gras.Dl cd srcdir \&; Nm Fl cf Pa -\ . | ( cd destdir \&; Nm Fl xpf Pa - )
595*543adbedSBen Gras.Pp
596*543adbedSBen GrasIn create mode, the list of files and directories to be archived
597*543adbedSBen Grascan also include directory change instructions of the form
598*543adbedSBen Gras.Cm -C Ns Pa foo/baz
599*543adbedSBen Grasand archive inclusions of the form
600*543adbedSBen Gras.Cm @ Ns Pa archive-file .
601*543adbedSBen GrasFor example, the command line
602*543adbedSBen Gras.Dl Nm Fl c Fl f Pa new.tar Pa foo1 Cm @ Ns Pa old.tgz Cm -C Ns Pa /tmp Pa foo2
603*543adbedSBen Graswill create a new archive
604*543adbedSBen Gras.Pa new.tar .
605*543adbedSBen Gras.Nm
606*543adbedSBen Graswill read the file
607*543adbedSBen Gras.Pa foo1
608*543adbedSBen Grasfrom the current directory and add it to the output archive.
609*543adbedSBen GrasIt will then read each entry from
610*543adbedSBen Gras.Pa old.tgz
611*543adbedSBen Grasand add those entries to the output archive.
612*543adbedSBen GrasFinally, it will switch to the
613*543adbedSBen Gras.Pa /tmp
614*543adbedSBen Grasdirectory and add
615*543adbedSBen Gras.Pa foo2
616*543adbedSBen Grasto the output archive.
617*543adbedSBen Gras.Pp
618*543adbedSBen GrasAn input file in
619*543adbedSBen Gras.Xr mtree 5
620*543adbedSBen Grasformat can be used to create an output archive with arbitrary ownership,
621*543adbedSBen Graspermissions, or names that differ from existing data on disk:
622*543adbedSBen Gras.Pp
623*543adbedSBen Gras.Dl $ cat input.mtree
624*543adbedSBen Gras.Dl #mtree
625*543adbedSBen Gras.Dl usr/bin uid=0 gid=0 mode=0755 type=dir
626*543adbedSBen Gras.Dl usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
627*543adbedSBen Gras.Dl $ tar -cvf output.tar @input.mtree
628*543adbedSBen Gras.Pp
629*543adbedSBen GrasThe
630*543adbedSBen Gras.Fl -newer
631*543adbedSBen Grasand
632*543adbedSBen Gras.Fl -newer-mtime
633*543adbedSBen Grasswitches accept a variety of common date and time specifications, including
634*543adbedSBen Gras.Dq 12 Mar 2005 7:14:29pm ,
635*543adbedSBen Gras.Dq 2005-03-12 19:14 ,
636*543adbedSBen Gras.Dq 5 minutes ago ,
637*543adbedSBen Grasand
638*543adbedSBen Gras.Dq 19:14 PST May 1 .
639*543adbedSBen Gras.Pp
640*543adbedSBen GrasThe
641*543adbedSBen Gras.Fl -options
642*543adbedSBen Grasargument can be used to control various details of archive generation
643*543adbedSBen Grasor reading.
644*543adbedSBen GrasFor example, you can generate mtree output which only contains
645*543adbedSBen Gras.Cm type , Cm time ,
646*543adbedSBen Grasand
647*543adbedSBen Gras.Cm uid
648*543adbedSBen Graskeywords:
649*543adbedSBen Gras.Dl Nm Fl cf Pa file.tar Fl -format=mtree Fl -options='!all,type,time,uid' Pa dir
650*543adbedSBen Grasor you can set the compression level used by gzip or xz compression:
651*543adbedSBen Gras.Dl Nm Fl czf Pa file.tar Fl -options='compression-level=9' .
652*543adbedSBen GrasFor more details, see the explanation of the
653*543adbedSBen Gras.Fn archive_read_set_options
654*543adbedSBen Grasand
655*543adbedSBen Gras.Fn archive_write_set_options
656*543adbedSBen GrasAPI calls that are described in
657*543adbedSBen Gras.Xr archive_read 3
658*543adbedSBen Grasand
659*543adbedSBen Gras.Xr archive_write 3 .
660*543adbedSBen Gras.Sh COMPATIBILITY
661*543adbedSBen GrasThe bundled-arguments format is supported for compatibility
662*543adbedSBen Graswith historic implementations.
663*543adbedSBen GrasIt consists of an initial word (with no leading - character) in which
664*543adbedSBen Graseach character indicates an option.
665*543adbedSBen GrasArguments follow as separate words.
666*543adbedSBen GrasThe order of the arguments must match the order
667*543adbedSBen Grasof the corresponding characters in the bundled command word.
668*543adbedSBen GrasFor example,
669*543adbedSBen Gras.Dl Nm Cm tbf 32 Pa file.tar
670*543adbedSBen Grasspecifies three flags
671*543adbedSBen Gras.Cm t ,
672*543adbedSBen Gras.Cm b ,
673*543adbedSBen Grasand
674*543adbedSBen Gras.Cm f .
675*543adbedSBen GrasThe
676*543adbedSBen Gras.Cm b
677*543adbedSBen Grasand
678*543adbedSBen Gras.Cm f
679*543adbedSBen Grasflags both require arguments,
680*543adbedSBen Grasso there must be two additional items
681*543adbedSBen Grason the command line.
682*543adbedSBen GrasThe
683*543adbedSBen Gras.Ar 32
684*543adbedSBen Grasis the argument to the
685*543adbedSBen Gras.Cm b
686*543adbedSBen Grasflag, and
687*543adbedSBen Gras.Ar file.tar
688*543adbedSBen Grasis the argument to the
689*543adbedSBen Gras.Cm f
690*543adbedSBen Grasflag.
691*543adbedSBen Gras.Pp
692*543adbedSBen GrasThe mode options c, r, t, u, and x and the options
693*543adbedSBen Grasb, f, l, m, o, v, and w comply with SUSv2.
694*543adbedSBen Gras.Pp
695*543adbedSBen GrasFor maximum portability, scripts that invoke
696*543adbedSBen Gras.Nm tar
697*543adbedSBen Grasshould use the bundled-argument format above, should limit
698*543adbedSBen Grasthemselves to the
699*543adbedSBen Gras.Cm c ,
700*543adbedSBen Gras.Cm t ,
701*543adbedSBen Grasand
702*543adbedSBen Gras.Cm x
703*543adbedSBen Grasmodes, and the
704*543adbedSBen Gras.Cm b ,
705*543adbedSBen Gras.Cm f ,
706*543adbedSBen Gras.Cm m ,
707*543adbedSBen Gras.Cm v ,
708*543adbedSBen Grasand
709*543adbedSBen Gras.Cm w
710*543adbedSBen Grasoptions.
711*543adbedSBen Gras.Pp
712*543adbedSBen GrasAdditional long options are provided to improve compatibility with other
713*543adbedSBen Grastar implementations.
714*543adbedSBen Gras.Sh SECURITY
715*543adbedSBen GrasCertain security issues are common to many archiving programs, including
716*543adbedSBen Gras.Nm .
717*543adbedSBen GrasIn particular, carefully-crafted archives can request that
718*543adbedSBen Gras.Nm
719*543adbedSBen Grasextract files to locations outside of the target directory.
720*543adbedSBen GrasThis can potentially be used to cause unwitting users to overwrite
721*543adbedSBen Grasfiles they did not intend to overwrite.
722*543adbedSBen GrasIf the archive is being extracted by the superuser, any file
723*543adbedSBen Grason the system can potentially be overwritten.
724*543adbedSBen GrasThere are three ways this can happen.
725*543adbedSBen GrasAlthough
726*543adbedSBen Gras.Nm
727*543adbedSBen Grashas mechanisms to protect against each one,
728*543adbedSBen Grassavvy users should be aware of the implications:
729*543adbedSBen Gras.Bl -bullet -width indent
730*543adbedSBen Gras.It
731*543adbedSBen GrasArchive entries can have absolute pathnames.
732*543adbedSBen GrasBy default,
733*543adbedSBen Gras.Nm
734*543adbedSBen Grasremoves the leading
735*543adbedSBen Gras.Pa /
736*543adbedSBen Grascharacter from filenames before restoring them to guard against this problem.
737*543adbedSBen Gras.It
738*543adbedSBen GrasArchive entries can have pathnames that include
739*543adbedSBen Gras.Pa ..
740*543adbedSBen Grascomponents.
741*543adbedSBen GrasBy default,
742*543adbedSBen Gras.Nm
743*543adbedSBen Graswill not extract files containing
744*543adbedSBen Gras.Pa ..
745*543adbedSBen Grascomponents in their pathname.
746*543adbedSBen Gras.It
747*543adbedSBen GrasArchive entries can exploit symbolic links to restore
748*543adbedSBen Grasfiles to other directories.
749*543adbedSBen GrasAn archive can restore a symbolic link to another directory,
750*543adbedSBen Grasthen use that link to restore a file into that directory.
751*543adbedSBen GrasTo guard against this,
752*543adbedSBen Gras.Nm
753*543adbedSBen Graschecks each extracted path for symlinks.
754*543adbedSBen GrasIf the final path element is a symlink, it will be removed
755*543adbedSBen Grasand replaced with the archive entry.
756*543adbedSBen GrasIf
757*543adbedSBen Gras.Fl U
758*543adbedSBen Grasis specified, any intermediate symlink will also be unconditionally removed.
759*543adbedSBen GrasIf neither
760*543adbedSBen Gras.Fl U
761*543adbedSBen Grasnor
762*543adbedSBen Gras.Fl P
763*543adbedSBen Grasis specified,
764*543adbedSBen Gras.Nm
765*543adbedSBen Graswill refuse to extract the entry.
766*543adbedSBen Gras.El
767*543adbedSBen GrasTo protect yourself, you should be wary of any archives that
768*543adbedSBen Grascome from untrusted sources.
769*543adbedSBen GrasYou should examine the contents of an archive with
770*543adbedSBen Gras.Dl Nm Fl tf Pa filename
771*543adbedSBen Grasbefore extraction.
772*543adbedSBen GrasYou should use the
773*543adbedSBen Gras.Fl k
774*543adbedSBen Grasoption to ensure that
775*543adbedSBen Gras.Nm
776*543adbedSBen Graswill not overwrite any existing files or the
777*543adbedSBen Gras.Fl U
778*543adbedSBen Grasoption to remove any pre-existing files.
779*543adbedSBen GrasYou should generally not extract archives while running with super-user
780*543adbedSBen Grasprivileges.
781*543adbedSBen GrasNote that the
782*543adbedSBen Gras.Fl P
783*543adbedSBen Grasoption to
784*543adbedSBen Gras.Nm
785*543adbedSBen Grasdisables the security checks above and allows you to extract
786*543adbedSBen Grasan archive while preserving any absolute pathnames,
787*543adbedSBen Gras.Pa ..
788*543adbedSBen Grascomponents, or symlinks to other directories.
789*543adbedSBen Gras.Sh SEE ALSO
790*543adbedSBen Gras.Xr bzip2 1 ,
791*543adbedSBen Gras.Xr compress 1 ,
792*543adbedSBen Gras.Xr cpio 1 ,
793*543adbedSBen Gras.Xr gzip 1 ,
794*543adbedSBen Gras.Xr mt 1 ,
795*543adbedSBen Gras.Xr pax 1 ,
796*543adbedSBen Gras.Xr shar 1 ,
797*543adbedSBen Gras.Xr libarchive 3 ,
798*543adbedSBen Gras.Xr libarchive-formats 5 ,
799*543adbedSBen Gras.Xr tar 5
800*543adbedSBen Gras.Sh STANDARDS
801*543adbedSBen GrasThere is no current POSIX standard for the tar command; it appeared
802*543adbedSBen Grasin
803*543adbedSBen Gras.St -p1003.1-96
804*543adbedSBen Grasbut was dropped from
805*543adbedSBen Gras.St -p1003.1-2001 .
806*543adbedSBen GrasThe options used by this implementation were developed by surveying a
807*543adbedSBen Grasnumber of existing tar implementations as well as the old POSIX specification
808*543adbedSBen Grasfor tar and the current POSIX specification for pax.
809*543adbedSBen Gras.Pp
810*543adbedSBen GrasThe ustar and pax interchange file formats are defined by
811*543adbedSBen Gras.St -p1003.1-2001
812*543adbedSBen Grasfor the pax command.
813*543adbedSBen Gras.Sh HISTORY
814*543adbedSBen GrasA
815*543adbedSBen Gras.Nm tar
816*543adbedSBen Grascommand appeared in Seventh Edition Unix, which was released in January, 1979.
817*543adbedSBen GrasThere have been numerous other implementations,
818*543adbedSBen Grasmany of which extended the file format.
819*543adbedSBen GrasJohn Gilmore's
820*543adbedSBen Gras.Nm pdtar
821*543adbedSBen Graspublic-domain implementation (circa November, 1987)
822*543adbedSBen Graswas quite influential, and formed the basis of GNU tar.
823*543adbedSBen GrasGNU tar was included as the standard system tar
824*543adbedSBen Grasin
825*543adbedSBen Gras.Fx
826*543adbedSBen Grasbeginning with
827*543adbedSBen Gras.Fx 1.0 .
828*543adbedSBen Gras.Pp
829*543adbedSBen GrasThis is a complete re-implementation based on the
830*543adbedSBen Gras.Xr libarchive 3
831*543adbedSBen Graslibrary.
832*543adbedSBen Gras.Sh BUGS
833*543adbedSBen GrasThis program follows
834*543adbedSBen Gras.St -p1003.1-96
835*543adbedSBen Grasfor the definition of the
836*543adbedSBen Gras.Fl l
837*543adbedSBen Grasoption.
838*543adbedSBen GrasNote that GNU tar prior to version 1.15 treated
839*543adbedSBen Gras.Fl l
840*543adbedSBen Grasas a synonym for the
841*543adbedSBen Gras.Fl -one-file-system
842*543adbedSBen Grasoption.
843*543adbedSBen Gras.Pp
844*543adbedSBen GrasThe
845*543adbedSBen Gras.Fl C Pa dir
846*543adbedSBen Grasoption may differ from historic implementations.
847*543adbedSBen Gras.Pp
848*543adbedSBen GrasAll archive output is written in correctly-sized blocks, even
849*543adbedSBen Grasif the output is being compressed.
850*543adbedSBen GrasWhether or not the last output block is padded to a full
851*543adbedSBen Grasblock size varies depending on the format and the
852*543adbedSBen Grasoutput device.
853*543adbedSBen GrasFor tar and cpio formats, the last block of output is padded
854*543adbedSBen Grasto a full block size if the output is being
855*543adbedSBen Graswritten to standard output or to a character or block device such as
856*543adbedSBen Grasa tape drive.
857*543adbedSBen GrasIf the output is being written to a regular file, the last block
858*543adbedSBen Graswill not be padded.
859*543adbedSBen GrasMany compressors, including
860*543adbedSBen Gras.Xr gzip 1
861*543adbedSBen Grasand
862*543adbedSBen Gras.Xr bzip2 1 ,
863*543adbedSBen Grascomplain about the null padding when decompressing an archive created by
864*543adbedSBen Gras.Nm ,
865*543adbedSBen Grasalthough they still extract it correctly.
866*543adbedSBen Gras.Pp
867*543adbedSBen GrasThe compression and decompression is implemented internally, so
868*543adbedSBen Grasthere may be insignificant differences between the compressed output
869*543adbedSBen Grasgenerated by
870*543adbedSBen Gras.Dl Nm Fl czf Pa - file
871*543adbedSBen Grasand that generated by
872*543adbedSBen Gras.Dl Nm Fl cf Pa - file | Nm gzip
873*543adbedSBen Gras.Pp
874*543adbedSBen GrasThe default should be to read and write archives to the standard I/O paths,
875*543adbedSBen Grasbut tradition (and POSIX) dictates otherwise.
876*543adbedSBen Gras.Pp
877*543adbedSBen GrasThe
878*543adbedSBen Gras.Cm r
879*543adbedSBen Grasand
880*543adbedSBen Gras.Cm u
881*543adbedSBen Grasmodes require that the archive be uncompressed
882*543adbedSBen Grasand located in a regular file on disk.
883*543adbedSBen GrasOther archives can be modified using
884*543adbedSBen Gras.Cm c
885*543adbedSBen Grasmode with the
886*543adbedSBen Gras.Pa @archive-file
887*543adbedSBen Grasextension.
888*543adbedSBen Gras.Pp
889*543adbedSBen GrasTo archive a file called
890*543adbedSBen Gras.Pa @foo
891*543adbedSBen Grasor
892*543adbedSBen Gras.Pa -foo
893*543adbedSBen Grasyou must specify it as
894*543adbedSBen Gras.Pa ./@foo
895*543adbedSBen Grasor
896*543adbedSBen Gras.Pa ./-foo ,
897*543adbedSBen Grasrespectively.
898*543adbedSBen Gras.Pp
899*543adbedSBen GrasIn create mode, a leading
900*543adbedSBen Gras.Pa ./
901*543adbedSBen Grasis always removed.
902*543adbedSBen GrasA leading
903*543adbedSBen Gras.Pa /
904*543adbedSBen Grasis stripped unless the
905*543adbedSBen Gras.Fl P
906*543adbedSBen Grasoption is specified.
907*543adbedSBen Gras.Pp
908*543adbedSBen GrasThere needs to be better support for file selection on both create
909*543adbedSBen Grasand extract.
910*543adbedSBen Gras.Pp
911*543adbedSBen GrasThere is not yet any support for multi-volume archives or for archiving
912*543adbedSBen Grassparse files.
913*543adbedSBen Gras.Pp
914*543adbedSBen GrasConverting between dissimilar archive formats (such as tar and cpio) using the
915*543adbedSBen Gras.Cm @ Ns Pa -
916*543adbedSBen Grasconvention can cause hard link information to be lost.
917*543adbedSBen Gras(This is a consequence of the incompatible ways that different archive
918*543adbedSBen Grasformats store hardlink information.)
919*543adbedSBen Gras.Pp
920*543adbedSBen GrasThere are alternative long options for many of the short options that
921*543adbedSBen Grasare deliberately not documented.
922