xref: /dflybsd-src/contrib/libarchive/tar/bsdtar.1 (revision 6b384f3989c11f4c0078ee986d3d85a2da3bf92a)
160b4ad09SPeter Avalos.\" Copyright (c) 2003-2007 Tim Kientzle
260b4ad09SPeter Avalos.\" All rights reserved.
360b4ad09SPeter Avalos.\"
460b4ad09SPeter Avalos.\" Redistribution and use in source and binary forms, with or without
560b4ad09SPeter Avalos.\" modification, are permitted provided that the following conditions
660b4ad09SPeter Avalos.\" are met:
760b4ad09SPeter Avalos.\" 1. Redistributions of source code must retain the above copyright
860b4ad09SPeter Avalos.\"    notice, this list of conditions and the following disclaimer.
960b4ad09SPeter Avalos.\" 2. Redistributions in binary form must reproduce the above copyright
1060b4ad09SPeter Avalos.\"    notice, this list of conditions and the following disclaimer in the
1160b4ad09SPeter Avalos.\"    documentation and/or other materials provided with the distribution.
1260b4ad09SPeter Avalos.\"
1360b4ad09SPeter Avalos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1460b4ad09SPeter Avalos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1560b4ad09SPeter Avalos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1660b4ad09SPeter Avalos.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1760b4ad09SPeter Avalos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1860b4ad09SPeter Avalos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1960b4ad09SPeter Avalos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2060b4ad09SPeter Avalos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2160b4ad09SPeter Avalos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2260b4ad09SPeter Avalos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2360b4ad09SPeter Avalos.\" SUCH DAMAGE.
2460b4ad09SPeter Avalos.\"
2559bf7050SPeter Avalos.\" $FreeBSD$
2660b4ad09SPeter Avalos.\"
27*6b384f39SPeter Avalos.Dd September 16, 2014
28c09f92d2SPeter Avalos.Dt TAR 1
2960b4ad09SPeter Avalos.Os
3060b4ad09SPeter Avalos.Sh NAME
3160b4ad09SPeter Avalos.Nm tar
3260b4ad09SPeter Avalos.Nd manipulate tape archives
3360b4ad09SPeter Avalos.Sh SYNOPSIS
3460b4ad09SPeter Avalos.Nm
3560b4ad09SPeter Avalos.Op Ar bundled-flags Ao args Ac
3660b4ad09SPeter Avalos.Op Ao Ar file Ac | Ao Ar pattern Ac ...
3760b4ad09SPeter Avalos.Nm
3860b4ad09SPeter Avalos.Brq Fl c
3960b4ad09SPeter Avalos.Op Ar options
408029ab02SPeter Avalos.Op Ar files | Ar directories
4160b4ad09SPeter Avalos.Nm
4260b4ad09SPeter Avalos.Brq Fl r | Fl u
4360b4ad09SPeter Avalos.Fl f Ar archive-file
4460b4ad09SPeter Avalos.Op Ar options
458029ab02SPeter Avalos.Op Ar files | Ar directories
4660b4ad09SPeter Avalos.Nm
4760b4ad09SPeter Avalos.Brq Fl t | Fl x
4860b4ad09SPeter Avalos.Op Ar options
4960b4ad09SPeter Avalos.Op Ar patterns
5060b4ad09SPeter Avalos.Sh DESCRIPTION
5160b4ad09SPeter Avalos.Nm
5260b4ad09SPeter Avaloscreates and manipulates streaming archive files.
53c09f92d2SPeter AvalosThis implementation can extract from tar, pax, cpio, zip, jar, ar, xar,
54c09f92d2SPeter Avalosrpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip,
55c09f92d2SPeter Avalos7-zip, and shar archives.
5660b4ad09SPeter Avalos.Pp
5760b4ad09SPeter AvalosThe first synopsis form shows a
5860b4ad09SPeter Avalos.Dq bundled
5960b4ad09SPeter Avalosoption word.
6060b4ad09SPeter AvalosThis usage is provided for compatibility with historical implementations.
6160b4ad09SPeter AvalosSee COMPATIBILITY below for details.
6260b4ad09SPeter Avalos.Pp
6360b4ad09SPeter AvalosThe other synopsis forms show the preferred usage.
6460b4ad09SPeter AvalosThe first option to
6560b4ad09SPeter Avalos.Nm
6660b4ad09SPeter Avalosis a mode indicator from the following list:
6760b4ad09SPeter Avalos.Bl -tag -compact -width indent
6860b4ad09SPeter Avalos.It Fl c
6960b4ad09SPeter AvalosCreate a new archive containing the specified items.
70c09f92d2SPeter AvalosThe long option form is
71c09f92d2SPeter Avalos.Fl Fl create .
7260b4ad09SPeter Avalos.It Fl r
7360b4ad09SPeter AvalosLike
7460b4ad09SPeter Avalos.Fl c ,
7560b4ad09SPeter Avalosbut new entries are appended to the archive.
7660b4ad09SPeter AvalosNote that this only works on uncompressed archives stored in regular files.
7760b4ad09SPeter AvalosThe
7860b4ad09SPeter Avalos.Fl f
7960b4ad09SPeter Avalosoption is required.
80c09f92d2SPeter AvalosThe long option form is
81c09f92d2SPeter Avalos.Fl Fl append .
8260b4ad09SPeter Avalos.It Fl t
8360b4ad09SPeter AvalosList archive contents to stdout.
84c09f92d2SPeter AvalosThe long option form is
85c09f92d2SPeter Avalos.Fl Fl list .
8660b4ad09SPeter Avalos.It Fl u
8760b4ad09SPeter AvalosLike
8860b4ad09SPeter Avalos.Fl r ,
8960b4ad09SPeter Avalosbut new entries are added only if they have a modification date
9060b4ad09SPeter Avalosnewer than the corresponding entry in the archive.
9160b4ad09SPeter AvalosNote that this only works on uncompressed archives stored in regular files.
9260b4ad09SPeter AvalosThe
9360b4ad09SPeter Avalos.Fl f
9460b4ad09SPeter Avalosoption is required.
95c09f92d2SPeter AvalosThe long form is
96c09f92d2SPeter Avalos.Fl Fl update .
9760b4ad09SPeter Avalos.It Fl x
9860b4ad09SPeter AvalosExtract to disk from the archive.
9960b4ad09SPeter AvalosIf a file with the same name appears more than once in the archive,
10060b4ad09SPeter Avaloseach copy will be extracted, with later copies overwriting (replacing)
10160b4ad09SPeter Avalosearlier copies.
102c09f92d2SPeter AvalosThe long option form is
103c09f92d2SPeter Avalos.Fl Fl extract .
10460b4ad09SPeter Avalos.El
10560b4ad09SPeter Avalos.Pp
10660b4ad09SPeter AvalosIn
10760b4ad09SPeter Avalos.Fl c ,
10860b4ad09SPeter Avalos.Fl r ,
10960b4ad09SPeter Avalosor
11060b4ad09SPeter Avalos.Fl u
11160b4ad09SPeter Avalosmode, each specified file or directory is added to the
11260b4ad09SPeter Avalosarchive in the order specified on the command line.
11360b4ad09SPeter AvalosBy default, the contents of each directory are also archived.
11460b4ad09SPeter Avalos.Pp
11560b4ad09SPeter AvalosIn extract or list mode, the entire command line
11660b4ad09SPeter Avalosis read and parsed before the archive is opened.
11760b4ad09SPeter AvalosThe pathnames or patterns on the command line indicate
11860b4ad09SPeter Avaloswhich items in the archive should be processed.
11960b4ad09SPeter AvalosPatterns are shell-style globbing patterns as
12060b4ad09SPeter Avalosdocumented in
12160b4ad09SPeter Avalos.Xr tcsh 1 .
12260b4ad09SPeter Avalos.Sh OPTIONS
12360b4ad09SPeter AvalosUnless specifically stated otherwise, options are applicable in
12460b4ad09SPeter Avalosall operating modes.
12560b4ad09SPeter Avalos.Bl -tag -width indent
12660b4ad09SPeter Avalos.It Cm @ Ns Pa archive
12760b4ad09SPeter Avalos(c and r mode only)
12860b4ad09SPeter AvalosThe specified archive is opened and the entries
12960b4ad09SPeter Avalosin it will be appended to the current archive.
13060b4ad09SPeter AvalosAs a simple example,
13160b4ad09SPeter Avalos.Dl Nm Fl c Fl f Pa - Pa newfile Cm @ Ns Pa original.tar
13260b4ad09SPeter Avaloswrites a new archive to standard output containing a file
13360b4ad09SPeter Avalos.Pa newfile
13460b4ad09SPeter Avalosand all of the entries from
13560b4ad09SPeter Avalos.Pa original.tar .
13660b4ad09SPeter AvalosIn contrast,
13760b4ad09SPeter Avalos.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
13860b4ad09SPeter Avaloscreates a new archive with only two entries.
13960b4ad09SPeter AvalosSimilarly,
140c09f92d2SPeter Avalos.Dl Nm Fl czf Pa - Fl Fl format Cm pax Cm @ Ns Pa -
14160b4ad09SPeter Avalosreads an archive from standard input (whose format will be determined
14260b4ad09SPeter Avalosautomatically) and converts it into a gzip-compressed
14360b4ad09SPeter Avalospax-format archive on stdout.
14460b4ad09SPeter AvalosIn this way,
14560b4ad09SPeter Avalos.Nm
14660b4ad09SPeter Avaloscan be used to convert archives from one format to another.
147d4d8193eSPeter Avalos.It Fl a , Fl Fl auto-compress
148d4d8193eSPeter Avalos(c mode only)
149d4d8193eSPeter AvalosUse the archive suffix to decide a set of the format and
150d4d8193eSPeter Avalosthe compressions.
151d4d8193eSPeter AvalosAs a simple example,
152d4d8193eSPeter Avalos.Dl Nm Fl a Fl cf Pa archive.tgz source.c source.h
153d4d8193eSPeter Avaloscreates a new archive with restricted pax format and gzip compression,
154d4d8193eSPeter Avalos.Dl Nm Fl a Fl cf Pa archive.tar.bz2.uu source.c source.h
155d4d8193eSPeter Avaloscreates a new archive with restricted pax format and bzip2 compression
156d4d8193eSPeter Avalosand uuencode compression,
157d4d8193eSPeter Avalos.Dl Nm Fl a Fl cf Pa archive.zip source.c source.h
158d4d8193eSPeter Avaloscreates a new archive with zip format,
159d4d8193eSPeter Avalos.Dl Nm Fl a Fl jcf Pa archive.tgz source.c source.h
160d4d8193eSPeter Avalosignores the
161d4d8193eSPeter Avalos.Dq -j
162d4d8193eSPeter Avalosoption, and creates a new archive with restricted pax format
163d4d8193eSPeter Avalosand gzip compression,
164d4d8193eSPeter Avalos.Dl Nm Fl a Fl jcf Pa archive.xxx source.c source.h
165d4d8193eSPeter Avalosif it is unknown suffix or no suffix, creates a new archive with
166d4d8193eSPeter Avalosrestricted pax format and bzip2 compression.
167c09f92d2SPeter Avalos.It Fl B , Fl Fl read-full-blocks
168c09f92d2SPeter AvalosIgnored for compatibility with other
169c09f92d2SPeter Avalos.Xr tar 1
170c09f92d2SPeter Avalosimplementations.
171c09f92d2SPeter Avalos.It Fl b Ar blocksize , Fl Fl block-size Ar blocksize
17260b4ad09SPeter AvalosSpecify the block size, in 512-byte records, for tape drive I/O.
17360b4ad09SPeter AvalosAs a rule, this argument is only needed when reading from or writing
17460b4ad09SPeter Avalosto tape drives, and usually not even then as the default block size of
17560b4ad09SPeter Avalos20 records (10240 bytes) is very common.
176c09f92d2SPeter Avalos.It Fl C Ar directory , Fl Fl cd Ar directory , Fl Fl directory Ar directory
17760b4ad09SPeter AvalosIn c and r mode, this changes the directory before adding
17860b4ad09SPeter Avalosthe following files.
17960b4ad09SPeter AvalosIn x mode, change directories after opening the archive
18060b4ad09SPeter Avalosbut before extracting entries from the archive.
181c09f92d2SPeter Avalos.It Fl Fl chroot
18260b4ad09SPeter Avalos(x mode only)
18360b4ad09SPeter Avalos.Fn chroot
18460b4ad09SPeter Avalosto the current directory after processing any
18560b4ad09SPeter Avalos.Fl C
18660b4ad09SPeter Avalosoptions and before extracting any files.
187*6b384f39SPeter Avalos.It Fl Fl clear-nochange-fflags
188*6b384f39SPeter Avalos(x mode only)
189*6b384f39SPeter AvalosBefore removing file system objects to replace them, clear platform-specific
190*6b384f39SPeter Avalosfile flags that might prevent removal.
191c09f92d2SPeter Avalos.It Fl Fl disable-copyfile
192c09f92d2SPeter AvalosMac OS X specific.
193c09f92d2SPeter AvalosDisable the use of
194c09f92d2SPeter Avalos.Xr copyfile 3 .
195c09f92d2SPeter Avalos.It Fl Fl exclude Ar pattern
19660b4ad09SPeter AvalosDo not process files or directories that match the
19760b4ad09SPeter Avalosspecified pattern.
19860b4ad09SPeter AvalosNote that exclusions take precedence over patterns or filenames
19960b4ad09SPeter Avalosspecified on the command line.
200c09f92d2SPeter Avalos.It Fl Fl format Ar format
20160b4ad09SPeter Avalos(c, r, u mode only)
20260b4ad09SPeter AvalosUse the specified format for the created archive.
20360b4ad09SPeter AvalosSupported formats include
20460b4ad09SPeter Avalos.Dq cpio ,
20560b4ad09SPeter Avalos.Dq pax ,
20660b4ad09SPeter Avalos.Dq shar ,
20760b4ad09SPeter Avalosand
20860b4ad09SPeter Avalos.Dq ustar .
20960b4ad09SPeter AvalosOther formats may also be supported; see
21060b4ad09SPeter Avalos.Xr libarchive-formats 5
21160b4ad09SPeter Avalosfor more information about currently-supported formats.
21260b4ad09SPeter AvalosIn r and u modes, when extending an existing archive, the format specified
21360b4ad09SPeter Avaloshere must be compatible with the format of the existing archive on disk.
214c09f92d2SPeter Avalos.It Fl f Ar file , Fl Fl file Ar file
21560b4ad09SPeter AvalosRead the archive from or write the archive to the specified file.
21660b4ad09SPeter AvalosThe filename can be
21760b4ad09SPeter Avalos.Pa -
21860b4ad09SPeter Avalosfor standard input or standard output.
219c09f92d2SPeter AvalosThe default varies by system;
220c09f92d2SPeter Avaloson
22160b4ad09SPeter Avalos.Fx ,
222c09f92d2SPeter Avalosthe default is
223c09f92d2SPeter Avalos.Pa /dev/sa0 ;
224c09f92d2SPeter Avaloson Linux, the default is
225c09f92d2SPeter Avalos.Pa /dev/st0 .
226c09f92d2SPeter Avalos.It Fl Fl gid Ar id
227c09f92d2SPeter AvalosUse the provided group id number.
228c09f92d2SPeter AvalosOn extract, this overrides the group id in the archive;
229c09f92d2SPeter Avalosthe group name in the archive will be ignored.
230c09f92d2SPeter AvalosOn create, this overrides the group id read from disk;
231c09f92d2SPeter Avalosif
232c09f92d2SPeter Avalos.Fl Fl gname
233c09f92d2SPeter Avalosis not also specified, the group name will be set to
234c09f92d2SPeter Avalosmatch the group id.
235c09f92d2SPeter Avalos.It Fl Fl gname Ar name
236c09f92d2SPeter AvalosUse the provided group name.
237c09f92d2SPeter AvalosOn extract, this overrides the group name in the archive;
238c09f92d2SPeter Avalosif the provided group name does not exist on the system,
239c09f92d2SPeter Avalosthe group id
240c09f92d2SPeter Avalos(from the archive or from the
241c09f92d2SPeter Avalos.Fl Fl gid
242c09f92d2SPeter Avalosoption)
243c09f92d2SPeter Avaloswill be used instead.
244c09f92d2SPeter AvalosOn create, this sets the group name that will be stored
245c09f92d2SPeter Avalosin the archive;
246c09f92d2SPeter Avalosthe name will not be verified against the system group database.
24760b4ad09SPeter Avalos.It Fl H
24860b4ad09SPeter Avalos(c and r mode only)
24960b4ad09SPeter AvalosSymbolic links named on the command line will be followed; the
25060b4ad09SPeter Avalostarget of the link will be archived, not the link itself.
25160b4ad09SPeter Avalos.It Fl h
25260b4ad09SPeter Avalos(c and r mode only)
25360b4ad09SPeter AvalosSynonym for
25460b4ad09SPeter Avalos.Fl L .
25560b4ad09SPeter Avalos.It Fl I
25660b4ad09SPeter AvalosSynonym for
25760b4ad09SPeter Avalos.Fl T .
258c09f92d2SPeter Avalos.It Fl Fl help
259c09f92d2SPeter AvalosShow usage.
260d4d8193eSPeter Avalos.It Fl Fl hfsCompression
261d4d8193eSPeter Avalos(x mode only)
262d4d8193eSPeter AvalosMac OS X specific(v10.6 or later). Compress extracted regular files with HFS+ compression.
263*6b384f39SPeter Avalos.It Fl Fl ignore-zeros
264*6b384f39SPeter AvalosAn alias of
265*6b384f39SPeter Avalos.Fl Fl options Cm read_concatenated_archives
266*6b384f39SPeter Avalosfor compatibility with GNU tar.
267c09f92d2SPeter Avalos.It Fl Fl include Ar pattern
26860b4ad09SPeter AvalosProcess only files or directories that match the specified pattern.
26960b4ad09SPeter AvalosNote that exclusions specified with
270c09f92d2SPeter Avalos.Fl Fl exclude
27160b4ad09SPeter Avalostake precedence over inclusions.
27260b4ad09SPeter AvalosIf no inclusions are explicitly specified, all entries are processed by
27360b4ad09SPeter Avalosdefault.
27460b4ad09SPeter AvalosThe
275c09f92d2SPeter Avalos.Fl Fl include
27660b4ad09SPeter Avalosoption is especially useful when filtering archives.
27760b4ad09SPeter AvalosFor example, the command
278c09f92d2SPeter Avalos.Dl Nm Fl c Fl f Pa new.tar Fl Fl include='*foo*' Cm @ Ns Pa old.tgz
27960b4ad09SPeter Avaloscreates a new archive
28060b4ad09SPeter Avalos.Pa new.tar
28160b4ad09SPeter Avaloscontaining only the entries from
28260b4ad09SPeter Avalos.Pa old.tgz
28360b4ad09SPeter Avaloscontaining the string
28460b4ad09SPeter Avalos.Sq foo .
285c09f92d2SPeter Avalos.It Fl J , Fl Fl xz
286c09f92d2SPeter Avalos(c mode only)
287c09f92d2SPeter AvalosCompress the resulting archive with
288c09f92d2SPeter Avalos.Xr xz 1 .
289c09f92d2SPeter AvalosIn extract or list modes, this option is ignored.
290c09f92d2SPeter AvalosNote that, unlike other
291c09f92d2SPeter Avalos.Nm tar
292c09f92d2SPeter Avalosimplementations, this implementation recognizes XZ compression
293c09f92d2SPeter Avalosautomatically when reading archives.
294c09f92d2SPeter Avalos.It Fl j , Fl Fl bzip , Fl Fl bzip2 , Fl Fl bunzip2
29560b4ad09SPeter Avalos(c mode only)
29660b4ad09SPeter AvalosCompress the resulting archive with
29760b4ad09SPeter Avalos.Xr bzip2 1 .
29860b4ad09SPeter AvalosIn extract or list modes, this option is ignored.
29960b4ad09SPeter AvalosNote that, unlike other
30060b4ad09SPeter Avalos.Nm tar
30160b4ad09SPeter Avalosimplementations, this implementation recognizes bzip2 compression
30260b4ad09SPeter Avalosautomatically when reading archives.
303c09f92d2SPeter Avalos.It Fl k , Fl Fl keep-old-files
30460b4ad09SPeter Avalos(x mode only)
30560b4ad09SPeter AvalosDo not overwrite existing files.
30660b4ad09SPeter AvalosIn particular, if a file appears more than once in an archive,
30760b4ad09SPeter Avaloslater copies will not overwrite earlier copies.
308c09f92d2SPeter Avalos.It Fl Fl keep-newer-files
30960b4ad09SPeter Avalos(x mode only)
31060b4ad09SPeter AvalosDo not overwrite existing files that are newer than the
31160b4ad09SPeter Avalosversions appearing in the archive being extracted.
312c09f92d2SPeter Avalos.It Fl L , Fl Fl dereference
31360b4ad09SPeter Avalos(c and r mode only)
31460b4ad09SPeter AvalosAll symbolic links will be followed.
31560b4ad09SPeter AvalosNormally, symbolic links are archived as such.
31660b4ad09SPeter AvalosWith this option, the target of the link will be archived instead.
317c09f92d2SPeter Avalos.It Fl l , Fl Fl check-links
318c09f92d2SPeter Avalos(c and r modes only)
319c09f92d2SPeter AvalosIssue a warning message unless all links to each file are archived.
320d4d8193eSPeter Avalos.It Fl Fl lrzip
321d4d8193eSPeter Avalos(c mode only)
322d4d8193eSPeter AvalosCompress the resulting archive with
323d4d8193eSPeter Avalos.Xr lrzip 1 .
324d4d8193eSPeter AvalosIn extract or list modes, this option is ignored.
325*6b384f39SPeter Avalos.It Fl Fl lz4
326*6b384f39SPeter Avalos(c mode only)
327*6b384f39SPeter AvalosCompress the archive with lz4-compatible compression before writing it.
328*6b384f39SPeter AvalosIn input mode, this option is ignored; lz4 compression is recognized
329*6b384f39SPeter Avalosautomatically on input.
330c09f92d2SPeter Avalos.It Fl Fl lzma
331c09f92d2SPeter Avalos(c mode only) Compress the resulting archive with the original LZMA algorithm.
332c09f92d2SPeter AvalosUse of this option is discouraged and new archives should be created with
333c09f92d2SPeter Avalos.Fl Fl xz
334c09f92d2SPeter Avalosinstead.
335c09f92d2SPeter AvalosNote that, unlike other
336c09f92d2SPeter Avalos.Nm tar
337c09f92d2SPeter Avalosimplementations, this implementation recognizes LZMA compression
338c09f92d2SPeter Avalosautomatically when reading archives.
339d4d8193eSPeter Avalos.It Fl Fl lzop
340d4d8193eSPeter Avalos(c mode only)
341d4d8193eSPeter AvalosCompress the resulting archive with
342d4d8193eSPeter Avalos.Xr lzop 1 .
343d4d8193eSPeter AvalosIn extract or list modes, this option is ignored.
344c09f92d2SPeter Avalos.It Fl m , Fl Fl modification-time
34560b4ad09SPeter Avalos(x mode only)
34660b4ad09SPeter AvalosDo not extract modification time.
34760b4ad09SPeter AvalosBy default, the modification time is set to the time stored in the archive.
348c09f92d2SPeter Avalos.It Fl n , Fl Fl norecurse , Fl Fl no-recursion
34960b4ad09SPeter Avalos(c, r, u modes only)
35060b4ad09SPeter AvalosDo not recursively archive the contents of directories.
351c09f92d2SPeter Avalos.It Fl Fl newer Ar date
35260b4ad09SPeter Avalos(c, r, u modes only)
35360b4ad09SPeter AvalosOnly include files and directories newer than the specified date.
35460b4ad09SPeter AvalosThis compares ctime entries.
355c09f92d2SPeter Avalos.It Fl Fl newer-mtime Ar date
35660b4ad09SPeter Avalos(c, r, u modes only)
35760b4ad09SPeter AvalosLike
358c09f92d2SPeter Avalos.Fl Fl newer ,
35960b4ad09SPeter Avalosexcept it compares mtime entries instead of ctime entries.
360c09f92d2SPeter Avalos.It Fl Fl newer-than Pa file
36160b4ad09SPeter Avalos(c, r, u modes only)
36260b4ad09SPeter AvalosOnly include files and directories newer than the specified file.
36360b4ad09SPeter AvalosThis compares ctime entries.
364c09f92d2SPeter Avalos.It Fl Fl newer-mtime-than Pa file
36560b4ad09SPeter Avalos(c, r, u modes only)
36660b4ad09SPeter AvalosLike
367c09f92d2SPeter Avalos.Fl Fl newer-than ,
36860b4ad09SPeter Avalosexcept it compares mtime entries instead of ctime entries.
369c09f92d2SPeter Avalos.It Fl Fl nodump
37060b4ad09SPeter Avalos(c and r modes only)
37160b4ad09SPeter AvalosHonor the nodump file flag by skipping this file.
372d4d8193eSPeter Avalos.It Fl Fl nopreserveHFSCompression
373d4d8193eSPeter Avalos(x mode only)
374d4d8193eSPeter AvalosMac OS X specific(v10.6 or later). Do not compress extracted regular files
375d4d8193eSPeter Avaloswhich were compressed with HFS+ compression before archived.
376d4d8193eSPeter AvalosBy default, compress the regular files again with HFS+ compression.
377c09f92d2SPeter Avalos.It Fl Fl null
37860b4ad09SPeter Avalos(use with
379c09f92d2SPeter Avalos.Fl I
38060b4ad09SPeter Avalosor
381c09f92d2SPeter Avalos.Fl T )
38260b4ad09SPeter AvalosFilenames or patterns are separated by null characters,
38360b4ad09SPeter Avalosnot by newlines.
38460b4ad09SPeter AvalosThis is often used to read filenames output by the
38560b4ad09SPeter Avalos.Fl print0
38660b4ad09SPeter Avalosoption to
38760b4ad09SPeter Avalos.Xr find 1 .
388c09f92d2SPeter Avalos.It Fl Fl no-same-owner
38960b4ad09SPeter Avalos(x mode only)
390c09f92d2SPeter AvalosDo not extract owner and group IDs.
391c09f92d2SPeter AvalosThis is the reverse of
392c09f92d2SPeter Avalos.Fl Fl same-owner
393c09f92d2SPeter Avalosand the default behavior if
394c09f92d2SPeter Avalos.Nm
395c09f92d2SPeter Avalosis run as non-root.
396c09f92d2SPeter Avalos.It Fl Fl no-same-permissions
397c09f92d2SPeter Avalos(x mode only)
398c09f92d2SPeter AvalosDo not extract full permissions (SGID, SUID, sticky bit, ACLs,
399c09f92d2SPeter Avalosextended attributes or extended file flags).
400c09f92d2SPeter AvalosThis is the reverse of
401c09f92d2SPeter Avalos.Fl p
402c09f92d2SPeter Avalosand the default behavior if
403c09f92d2SPeter Avalos.Nm
404c09f92d2SPeter Avalosis run as non-root.
405c09f92d2SPeter Avalos.It Fl Fl numeric-owner
406c09f92d2SPeter AvalosThis is equivalent to
407c09f92d2SPeter Avalos.Fl Fl uname
408c09f92d2SPeter Avalos.Qq
409c09f92d2SPeter Avalos.Fl Fl gname
410c09f92d2SPeter Avalos.Qq .
411c09f92d2SPeter AvalosOn extract, it causes user and group names in the archive
412c09f92d2SPeter Avalosto be ignored in favor of the numeric user and group ids.
413c09f92d2SPeter AvalosOn create, it causes user and group names to not be stored
414c09f92d2SPeter Avalosin the archive.
415c09f92d2SPeter Avalos.It Fl O , Fl Fl to-stdout
41660b4ad09SPeter Avalos(x, t modes only)
41760b4ad09SPeter AvalosIn extract (-x) mode, files will be written to standard out rather than
41860b4ad09SPeter Avalosbeing extracted to disk.
41960b4ad09SPeter AvalosIn list (-t) mode, the file listing will be written to stderr rather than
42060b4ad09SPeter Avalosthe usual stdout.
42160b4ad09SPeter Avalos.It Fl o
42260b4ad09SPeter Avalos(x mode)
42360b4ad09SPeter AvalosUse the user and group of the user running the program rather
42460b4ad09SPeter Avalosthan those specified in the archive.
42560b4ad09SPeter AvalosNote that this has no significance unless
42660b4ad09SPeter Avalos.Fl p
42760b4ad09SPeter Avalosis specified, and the program is being run by the root user.
42860b4ad09SPeter AvalosIn this case, the file modes and flags from
42960b4ad09SPeter Avalosthe archive will be restored, but ACLs or owner information in
43060b4ad09SPeter Avalosthe archive will be discarded.
43160b4ad09SPeter Avalos.It Fl o
43260b4ad09SPeter Avalos(c, r, u mode)
43360b4ad09SPeter AvalosA synonym for
434c09f92d2SPeter Avalos.Fl Fl format Ar ustar
435d4d8193eSPeter Avalos.It Fl Fl older Ar date
436d4d8193eSPeter Avalos(c, r, u modes only)
437d4d8193eSPeter AvalosOnly include files and directories older than the specified date.
438d4d8193eSPeter AvalosThis compares ctime entries.
439d4d8193eSPeter Avalos.It Fl Fl older-mtime Ar date
440d4d8193eSPeter Avalos(c, r, u modes only)
441d4d8193eSPeter AvalosLike
442d4d8193eSPeter Avalos.Fl Fl older ,
443d4d8193eSPeter Avalosexcept it compares mtime entries instead of ctime entries.
444d4d8193eSPeter Avalos.It Fl Fl older-than Pa file
445d4d8193eSPeter Avalos(c, r, u modes only)
446d4d8193eSPeter AvalosOnly include files and directories older than the specified file.
447d4d8193eSPeter AvalosThis compares ctime entries.
448d4d8193eSPeter Avalos.It Fl Fl older-mtime-than Pa file
449d4d8193eSPeter Avalos(c, r, u modes only)
450d4d8193eSPeter AvalosLike
451d4d8193eSPeter Avalos.Fl Fl older-than ,
452d4d8193eSPeter Avalosexcept it compares mtime entries instead of ctime entries.
453c09f92d2SPeter Avalos.It Fl Fl one-file-system
45460b4ad09SPeter Avalos(c, r, and u modes)
45560b4ad09SPeter AvalosDo not cross mount points.
456c09f92d2SPeter Avalos.It Fl Fl options Ar options
4578029ab02SPeter AvalosSelect optional behaviors for particular modules.
4588029ab02SPeter AvalosThe argument is a text string containing comma-separated
4598029ab02SPeter Avaloskeywords and values.
4608029ab02SPeter AvalosThese are passed to the modules that handle particular
4618029ab02SPeter Avalosformats to control how those formats will behave.
4628029ab02SPeter AvalosEach option has one of the following forms:
4638029ab02SPeter Avalos.Bl -tag -compact -width indent
4648029ab02SPeter Avalos.It Ar key=value
4658029ab02SPeter AvalosThe key will be set to the specified value in every module that supports it.
4668029ab02SPeter AvalosModules that do not support this key will ignore it.
4678029ab02SPeter Avalos.It Ar key
4688029ab02SPeter AvalosThe key will be enabled in every module that supports it.
4698029ab02SPeter AvalosThis is equivalent to
4708029ab02SPeter Avalos.Ar key Ns Cm =1 .
4718029ab02SPeter Avalos.It Ar !key
4728029ab02SPeter AvalosThe key will be disabled in every module that supports it.
4738029ab02SPeter Avalos.It Ar module:key=value , Ar module:key , Ar module:!key
4748029ab02SPeter AvalosAs above, but the corresponding key and value will be provided
4758029ab02SPeter Avalosonly to modules whose name matches
4768029ab02SPeter Avalos.Ar module .
4778029ab02SPeter Avalos.El
4788029ab02SPeter AvalosThe currently supported modules and keys are:
4798029ab02SPeter Avalos.Bl -tag -compact -width indent
4808029ab02SPeter Avalos.It Cm iso9660:joliet
4818029ab02SPeter AvalosSupport Joliet extensions.
4828029ab02SPeter AvalosThis is enabled by default, use
4838029ab02SPeter Avalos.Cm !joliet
4848029ab02SPeter Avalosor
4858029ab02SPeter Avalos.Cm iso9660:!joliet
4868029ab02SPeter Avalosto disable.
4879c82a63eSPeter Avalos.It Cm iso9660:rockridge
4889c82a63eSPeter AvalosSupport Rock Ridge extensions.
4899c82a63eSPeter AvalosThis is enabled by default, use
4909c82a63eSPeter Avalos.Cm !rockridge
4919c82a63eSPeter Avalosor
4929c82a63eSPeter Avalos.Cm iso9660:!rockridge
4939c82a63eSPeter Avalosto disable.
4948029ab02SPeter Avalos.It Cm gzip:compression-level
495d4d8193eSPeter AvalosA decimal integer from 1 to 9 specifying the gzip compression level.
496d4d8193eSPeter Avalos.It Cm gzip:timestamp
497d4d8193eSPeter AvalosStore timestamp. This is enabled by default, use
498d4d8193eSPeter Avalos.Cm !timestamp
499d4d8193eSPeter Avalosor
500d4d8193eSPeter Avalos.Cm gzip:!timestamp
501d4d8193eSPeter Avalosto disable.
502d4d8193eSPeter Avalos.It Cm lrzip:compression Ns = Ns Ar type
503d4d8193eSPeter AvalosUse
504d4d8193eSPeter Avalos.Ar type
505d4d8193eSPeter Avalosas compression method.
506d4d8193eSPeter AvalosSupported values are bzip2, gzip, lzo (ultra fast),
507d4d8193eSPeter Avalosand zpaq (best, extremely slow).
508d4d8193eSPeter Avalos.It Cm lrzip:compression-level
509d4d8193eSPeter AvalosA decimal integer from 1 to 9 specifying the lrzip compression level.
510*6b384f39SPeter Avalos.It Cm lz4:compression-level
511*6b384f39SPeter AvalosA decimal integer from 1 to 9 specifying the lzop compression level.
512*6b384f39SPeter Avalos.It Cm lz4:stream-checksum
513*6b384f39SPeter AvalosEnable stream checksum. This is by default, use
514*6b384f39SPeter Avalos.Cm lz4:!stream-checksum
515*6b384f39SPeter Avalosto disable.
516*6b384f39SPeter Avalos.It Cm lz4:block-checksum
517*6b384f39SPeter AvalosEnable block checksum (Disabled by default).
518*6b384f39SPeter Avalos.It Cm lz4:block-size
519*6b384f39SPeter AvalosA decimal integer from 4 to 7 specifying the lz4 compression block size
520*6b384f39SPeter Avalos(7 is set by default).
521*6b384f39SPeter Avalos.It Cm lz4:block-dependence
522*6b384f39SPeter AvalosUse the previous block of the block being compressed for
523*6b384f39SPeter Avalosa compression dictionary to improve compression ratio.
524d4d8193eSPeter Avalos.It Cm lzop:compression-level
525d4d8193eSPeter AvalosA decimal integer from 1 to 9 specifying the lzop compression level.
5268029ab02SPeter Avalos.It Cm xz:compression-level
5278029ab02SPeter AvalosA decimal integer from 0 to 9 specifying the xz compression level.
5288029ab02SPeter Avalos.It Cm mtree: Ns Ar keyword
5298029ab02SPeter AvalosThe mtree writer module allows you to specify which mtree keywords
5308029ab02SPeter Avaloswill be included in the output.
5318029ab02SPeter AvalosSupported keywords include:
5328029ab02SPeter Avalos.Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent ,
5338029ab02SPeter Avalos.Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 ,
5348029ab02SPeter Avalos.Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname .
5358029ab02SPeter AvalosThe default is equivalent to:
5368029ab02SPeter Avalos.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
5378029ab02SPeter Avalos.It Cm mtree:all
5388029ab02SPeter AvalosEnables all of the above keywords.
5398029ab02SPeter AvalosYou can also use
5408029ab02SPeter Avalos.Cm mtree:!all
5418029ab02SPeter Avalosto disable all keywords.
5428029ab02SPeter Avalos.It Cm mtree:use-set
5438029ab02SPeter AvalosEnable generation of
5448029ab02SPeter Avalos.Cm /set
5458029ab02SPeter Avaloslines in the output.
5468029ab02SPeter Avalos.It Cm mtree:indent
5479c82a63eSPeter AvalosProduce human-readable output by indenting options and splitting lines
5489c82a63eSPeter Avalosto fit into 80 columns.
5499c82a63eSPeter Avalos.It Cm zip:compression Ns = Ns Ar type
5509c82a63eSPeter AvalosUse
5519c82a63eSPeter Avalos.Ar type
5529c82a63eSPeter Avalosas compression method.
5539c82a63eSPeter AvalosSupported values are store (uncompressed) and deflate (gzip algorithm).
554*6b384f39SPeter Avalos.It Cm zip:encryption
555*6b384f39SPeter AvalosEnable encryption using traditional zip encryption.
556*6b384f39SPeter Avalos.It Cm zip:encryption Ns = Ns Ar type
557*6b384f39SPeter AvalosUse
558*6b384f39SPeter Avalos.Ar type
559*6b384f39SPeter Avalosas encryption type.
560*6b384f39SPeter AvalosSupported values are zipcrypt (traditional zip encryption),
561*6b384f39SPeter Avalosaes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryption).
562*6b384f39SPeter Avalos.It Cm read_concatenated_archives
563*6b384f39SPeter AvalosIgnore zeroed blocks in the archive, which occurs when multiple tar archives
564*6b384f39SPeter Avaloshave been concatenated together.  Without this option, only the contents of
565*6b384f39SPeter Avalosthe first concatenated archive would be read.  This option is comparable to
566*6b384f39SPeter Avalosthe
567*6b384f39SPeter Avalos.Fl i , Fl Fl ignore-zeros
568*6b384f39SPeter Avalosoption of GNU tar.
5698029ab02SPeter Avalos.El
5708029ab02SPeter AvalosIf a provided option is not supported by any module, that
5718029ab02SPeter Avalosis a fatal error.
572c09f92d2SPeter Avalos.It Fl P , Fl Fl absolute-paths
57360b4ad09SPeter AvalosPreserve pathnames.
57460b4ad09SPeter AvalosBy default, absolute pathnames (those that begin with a /
57560b4ad09SPeter Avaloscharacter) have the leading slash removed both when creating archives
57660b4ad09SPeter Avalosand extracting from them.
57760b4ad09SPeter AvalosAlso,
57860b4ad09SPeter Avalos.Nm
57960b4ad09SPeter Avaloswill refuse to extract archive entries whose pathnames contain
58060b4ad09SPeter Avalos.Pa ..
58160b4ad09SPeter Avalosor whose target directory would be altered by a symlink.
58260b4ad09SPeter AvalosThis option suppresses these behaviors.
583c09f92d2SPeter Avalos.It Fl p , Fl Fl insecure , Fl Fl preserve-permissions
58460b4ad09SPeter Avalos(x mode only)
58560b4ad09SPeter AvalosPreserve file permissions.
58660b4ad09SPeter AvalosAttempt to restore the full permissions, including owner, file modes, file
58760b4ad09SPeter Avalosflags and ACLs, if available, for each item extracted from the archive.
588c09f92d2SPeter AvalosThis is the default, if
58960b4ad09SPeter Avalos.Nm
59055c601bbSPeter Avalosis being run by root and can be overridden by also specifying
591c09f92d2SPeter Avalos.Fl Fl no-same-owner
592c09f92d2SPeter Avalosand
593c09f92d2SPeter Avalos.Fl Fl no-same-permissions .
594*6b384f39SPeter Avalos.It Fl Fl passphrase Ar passphrase
595*6b384f39SPeter AvalosThe
596*6b384f39SPeter Avalos.Pa passphrase
597*6b384f39SPeter Avalosis used to extract or create an encrypted archive.
598*6b384f39SPeter AvalosCurrently, zip is the only supported format that supports encryption.
599*6b384f39SPeter AvalosYou shouldn't use this option unless you realize how insecure
600*6b384f39SPeter Avalosuse of this option is.
601c09f92d2SPeter Avalos.It Fl Fl posix
602c09f92d2SPeter Avalos(c, r, u mode only)
603c09f92d2SPeter AvalosSynonym for
604c09f92d2SPeter Avalos.Fl Fl format Ar pax
605c09f92d2SPeter Avalos.It Fl q , Fl Fl fast-read
60660b4ad09SPeter Avalos(x and t mode only)
60760b4ad09SPeter AvalosExtract or list only the first archive entry that matches each pattern
60860b4ad09SPeter Avalosor filename operand.
60960b4ad09SPeter AvalosExit as soon as each specified pattern or filename has been matched.
61060b4ad09SPeter AvalosBy default, the archive is always read to the very end, since
61160b4ad09SPeter Avalosthere can be multiple entries with the same name and, by convention,
61260b4ad09SPeter Avaloslater entries overwrite earlier entries.
61360b4ad09SPeter AvalosThis option is provided as a performance optimization.
61460b4ad09SPeter Avalos.It Fl S
61560b4ad09SPeter Avalos(x mode only)
61660b4ad09SPeter AvalosExtract files as sparse files.
61760b4ad09SPeter AvalosFor every block on disk, check first if it contains only NULL bytes and seek
61860b4ad09SPeter Avalosover it otherwise.
619c09f92d2SPeter AvalosThis works similar to the conv=sparse option of dd.
62060b4ad09SPeter Avalos.It Fl s Ar pattern
62160b4ad09SPeter AvalosModify file or archive member names according to
62260b4ad09SPeter Avalos.Pa pattern .
6239c82a63eSPeter AvalosThe pattern has the format
624c09f92d2SPeter Avalos.Ar /old/new/ Ns Op ghHprRsS
6259c82a63eSPeter Avaloswhere
6269c82a63eSPeter Avalos.Ar old
6279c82a63eSPeter Avalosis a basic regular expression,
6289c82a63eSPeter Avalos.Ar new
6299c82a63eSPeter Avalosis the replacement string of the matched part,
6309c82a63eSPeter Avalosand the optional trailing letters modify
6319c82a63eSPeter Avaloshow the replacement is handled.
6329c82a63eSPeter AvalosIf
6339c82a63eSPeter Avalos.Ar old
6349c82a63eSPeter Avalosis not matched, the pattern is skipped.
6359c82a63eSPeter AvalosWithin
6369c82a63eSPeter Avalos.Ar new ,
6379c82a63eSPeter Avalos~ is substituted with the match, \e1 to \e9 with the content of
63860b4ad09SPeter Avalosthe corresponding captured group.
63960b4ad09SPeter AvalosThe optional trailing g specifies that matching should continue
640c09f92d2SPeter Avalosafter the matched part and stop on the first unmatched pattern.
64160b4ad09SPeter AvalosThe optional trailing s specifies that the pattern applies to the value
64260b4ad09SPeter Avalosof symbolic links.
64360b4ad09SPeter AvalosThe optional trailing p specifies that after a successful substitution
64460b4ad09SPeter Avalosthe original path name and the new path name should be printed to
64560b4ad09SPeter Avalosstandard error.
646c09f92d2SPeter AvalosOptional trailing H, R, or S characters suppress substitutions
647c09f92d2SPeter Avalosfor hardlink targets, regular filenames, or symlink targets,
648c09f92d2SPeter Avalosrespectively.
649c09f92d2SPeter AvalosOptional trailing h, r, or s characters enable substitutions
650c09f92d2SPeter Avalosfor hardlink targets, regular filenames, or symlink targets,
651c09f92d2SPeter Avalosrespectively.
652c09f92d2SPeter AvalosThe default is
653c09f92d2SPeter Avalos.Ar hrs
654c09f92d2SPeter Avaloswhich applies substitutions to all names.
655c09f92d2SPeter AvalosIn particular, it is never necessary to specify h, r, or s.
656c09f92d2SPeter Avalos.It Fl Fl same-owner
657c09f92d2SPeter Avalos(x mode only)
658c09f92d2SPeter AvalosExtract owner and group IDs.
659c09f92d2SPeter AvalosThis is the reverse of
660c09f92d2SPeter Avalos.Fl Fl no-same-owner
661c09f92d2SPeter Avalosand the default behavior if
662c09f92d2SPeter Avalos.Nm
663c09f92d2SPeter Avalosis run as root.
664c09f92d2SPeter Avalos.It Fl Fl strip-components Ar count
665c09f92d2SPeter AvalosRemove the specified number of leading path elements.
666c09f92d2SPeter AvalosPathnames with fewer elements will be silently skipped.
667c09f92d2SPeter AvalosNote that the pathname is edited after checking inclusion/exclusion patterns
668c09f92d2SPeter Avalosbut before security checks.
669c09f92d2SPeter Avalos.It Fl T Ar filename , Fl Fl files-from Ar filename
67060b4ad09SPeter AvalosIn x or t mode,
67160b4ad09SPeter Avalos.Nm
67260b4ad09SPeter Avaloswill read the list of names to be extracted from
67360b4ad09SPeter Avalos.Pa filename .
67460b4ad09SPeter AvalosIn c mode,
67560b4ad09SPeter Avalos.Nm
67660b4ad09SPeter Avaloswill read names to be archived from
67760b4ad09SPeter Avalos.Pa filename .
67860b4ad09SPeter AvalosThe special name
67960b4ad09SPeter Avalos.Dq -C
68060b4ad09SPeter Avaloson a line by itself will cause the current directory to be changed to
68160b4ad09SPeter Avalosthe directory specified on the following line.
68260b4ad09SPeter AvalosNames are terminated by newlines unless
683c09f92d2SPeter Avalos.Fl Fl null
68460b4ad09SPeter Avalosis specified.
68560b4ad09SPeter AvalosNote that
686c09f92d2SPeter Avalos.Fl Fl null
68760b4ad09SPeter Avalosalso disables the special handling of lines containing
68860b4ad09SPeter Avalos.Dq -C .
689d4d8193eSPeter AvalosNote:  If you are generating lists of files using
690d4d8193eSPeter Avalos.Xr find 1 ,
691d4d8193eSPeter Avalosyou probably want to use
692d4d8193eSPeter Avalos.Fl n
693d4d8193eSPeter Avalosas well.
694c09f92d2SPeter Avalos.It Fl Fl totals
695c09f92d2SPeter Avalos(c, r, u mode only)
696c09f92d2SPeter AvalosAfter archiving all files, print a summary to stderr.
697c09f92d2SPeter Avalos.It Fl U , Fl Fl unlink , Fl Fl unlink-first
69860b4ad09SPeter Avalos(x mode only)
69960b4ad09SPeter AvalosUnlink files before creating them.
700c09f92d2SPeter AvalosThis can be a minor performance optimization if most files
701c09f92d2SPeter Avalosalready exist, but can make things slower if most files
702c09f92d2SPeter Avalosdo not already exist.
703c09f92d2SPeter AvalosThis flag also causes
70460b4ad09SPeter Avalos.Nm
705c09f92d2SPeter Avalosto remove intervening directory symlinks instead of
706c09f92d2SPeter Avalosreporting an error.
707c09f92d2SPeter AvalosSee the SECURITY section below for more details.
708c09f92d2SPeter Avalos.It Fl Fl uid Ar id
709c09f92d2SPeter AvalosUse the provided user id number and ignore the user
710c09f92d2SPeter Avalosname from the archive.
711c09f92d2SPeter AvalosOn create, if
712c09f92d2SPeter Avalos.Fl Fl uname
713c09f92d2SPeter Avalosis not also specified, the user name will be set to
714c09f92d2SPeter Avalosmatch the user id.
715c09f92d2SPeter Avalos.It Fl Fl uname Ar name
716c09f92d2SPeter AvalosUse the provided user name.
717c09f92d2SPeter AvalosOn extract, this overrides the user name in the archive;
718c09f92d2SPeter Avalosif the provided user name does not exist on the system,
719c09f92d2SPeter Avalosit will be ignored and the user id
720c09f92d2SPeter Avalos(from the archive or from the
721c09f92d2SPeter Avalos.Fl Fl uid
722c09f92d2SPeter Avalosoption)
723c09f92d2SPeter Avaloswill be used instead.
724c09f92d2SPeter AvalosOn create, this sets the user name that will be stored
725c09f92d2SPeter Avalosin the archive;
726c09f92d2SPeter Avalosthe name is not verified against the system user database.
727c09f92d2SPeter Avalos.It Fl Fl use-compress-program Ar program
72860b4ad09SPeter AvalosPipe the input (in x or t mode) or the output (in c mode) through
72960b4ad09SPeter Avalos.Pa program
73060b4ad09SPeter Avalosinstead of using the builtin compression support.
731c09f92d2SPeter Avalos.It Fl v , Fl Fl verbose
73260b4ad09SPeter AvalosProduce verbose output.
73360b4ad09SPeter AvalosIn create and extract modes,
73460b4ad09SPeter Avalos.Nm
73560b4ad09SPeter Avaloswill list each file name as it is read from or written to
73660b4ad09SPeter Avalosthe archive.
73760b4ad09SPeter AvalosIn list mode,
73860b4ad09SPeter Avalos.Nm
73960b4ad09SPeter Avaloswill produce output similar to that of
74060b4ad09SPeter Avalos.Xr ls 1 .
741*6b384f39SPeter AvalosAn additional
74260b4ad09SPeter Avalos.Fl v
743*6b384f39SPeter Avalosoption will also provide ls-like details in create and extract mode.
744c09f92d2SPeter Avalos.It Fl Fl version
7458029ab02SPeter AvalosPrint version of
7468029ab02SPeter Avalos.Nm
7478029ab02SPeter Avalosand
7488029ab02SPeter Avalos.Nm libarchive ,
7498029ab02SPeter Avalosand exit.
750c09f92d2SPeter Avalos.It Fl w , Fl Fl confirmation , Fl Fl interactive
75160b4ad09SPeter AvalosAsk for confirmation for every action.
752c09f92d2SPeter Avalos.It Fl X Ar filename , Fl Fl exclude-from Ar filename
75360b4ad09SPeter AvalosRead a list of exclusion patterns from the specified file.
75460b4ad09SPeter AvalosSee
755c09f92d2SPeter Avalos.Fl Fl exclude
75660b4ad09SPeter Avalosfor more information about the handling of exclusions.
75760b4ad09SPeter Avalos.It Fl y
75860b4ad09SPeter Avalos(c mode only)
75960b4ad09SPeter AvalosCompress the resulting archive with
76060b4ad09SPeter Avalos.Xr bzip2 1 .
76160b4ad09SPeter AvalosIn extract or list modes, this option is ignored.
76260b4ad09SPeter AvalosNote that, unlike other
76360b4ad09SPeter Avalos.Nm tar
76460b4ad09SPeter Avalosimplementations, this implementation recognizes bzip2 compression
76560b4ad09SPeter Avalosautomatically when reading archives.
766c09f92d2SPeter Avalos.It Fl Z , Fl Fl compress , Fl Fl uncompress
76760b4ad09SPeter Avalos(c mode only)
76860b4ad09SPeter AvalosCompress the resulting archive with
76960b4ad09SPeter Avalos.Xr compress 1 .
77060b4ad09SPeter AvalosIn extract or list modes, this option is ignored.
77160b4ad09SPeter AvalosNote that, unlike other
77260b4ad09SPeter Avalos.Nm tar
77360b4ad09SPeter Avalosimplementations, this implementation recognizes compress compression
77460b4ad09SPeter Avalosautomatically when reading archives.
775c09f92d2SPeter Avalos.It Fl z , Fl Fl gunzip , Fl Fl gzip
776c09f92d2SPeter Avalos(c mode only)
777c09f92d2SPeter AvalosCompress the resulting archive with
778c09f92d2SPeter Avalos.Xr gzip 1 .
779c09f92d2SPeter AvalosIn extract or list modes, this option is ignored.
780c09f92d2SPeter AvalosNote that, unlike other
781c09f92d2SPeter Avalos.Nm tar
782c09f92d2SPeter Avalosimplementations, this implementation recognizes gzip compression
783c09f92d2SPeter Avalosautomatically when reading archives.
78460b4ad09SPeter Avalos.El
78560b4ad09SPeter Avalos.Sh ENVIRONMENT
78660b4ad09SPeter AvalosThe following environment variables affect the execution of
78760b4ad09SPeter Avalos.Nm :
78860b4ad09SPeter Avalos.Bl -tag -width ".Ev BLOCKSIZE"
789d4d8193eSPeter Avalos.It Ev TAR_READER_OPTIONS
790d4d8193eSPeter AvalosThe default options for format readers and compression readers.
791d4d8193eSPeter AvalosThe
792d4d8193eSPeter Avalos.Fl Fl options
793d4d8193eSPeter Avalosoption overrides this.
794d4d8193eSPeter Avalos.It Ev TAR_WRITER_OPTIONS
795d4d8193eSPeter AvalosThe default options for format writers and compression writers.
796d4d8193eSPeter AvalosThe
797d4d8193eSPeter Avalos.Fl Fl options
798d4d8193eSPeter Avalosoption overrides this.
79960b4ad09SPeter Avalos.It Ev LANG
80060b4ad09SPeter AvalosThe locale to use.
80160b4ad09SPeter AvalosSee
80260b4ad09SPeter Avalos.Xr environ 7
80360b4ad09SPeter Avalosfor more information.
80460b4ad09SPeter Avalos.It Ev TAPE
805c09f92d2SPeter AvalosThe default device.
80660b4ad09SPeter AvalosThe
80760b4ad09SPeter Avalos.Fl f
80860b4ad09SPeter Avalosoption overrides this.
809c09f92d2SPeter AvalosPlease see the description of the
810c09f92d2SPeter Avalos.Fl f
811c09f92d2SPeter Avalosoption above for more details.
81260b4ad09SPeter Avalos.It Ev TZ
81360b4ad09SPeter AvalosThe timezone to use when displaying dates.
81460b4ad09SPeter AvalosSee
81560b4ad09SPeter Avalos.Xr environ 7
81660b4ad09SPeter Avalosfor more information.
81760b4ad09SPeter Avalos.El
818c09f92d2SPeter Avalos.Sh EXIT STATUS
819c09f92d2SPeter Avalos.Ex -std
82060b4ad09SPeter Avalos.Sh EXAMPLES
82160b4ad09SPeter AvalosThe following creates a new archive
82260b4ad09SPeter Avaloscalled
82360b4ad09SPeter Avalos.Ar file.tar.gz
82460b4ad09SPeter Avalosthat contains two files
82560b4ad09SPeter Avalos.Ar source.c
82660b4ad09SPeter Avalosand
82760b4ad09SPeter Avalos.Ar source.h :
82860b4ad09SPeter Avalos.Dl Nm Fl czf Pa file.tar.gz Pa source.c Pa source.h
82960b4ad09SPeter Avalos.Pp
83060b4ad09SPeter AvalosTo view a detailed table of contents for this
83160b4ad09SPeter Avalosarchive:
83260b4ad09SPeter Avalos.Dl Nm Fl tvf Pa file.tar.gz
83360b4ad09SPeter Avalos.Pp
83460b4ad09SPeter AvalosTo extract all entries from the archive on
83560b4ad09SPeter Avalosthe default tape drive:
83660b4ad09SPeter Avalos.Dl Nm Fl x
83760b4ad09SPeter Avalos.Pp
83860b4ad09SPeter AvalosTo examine the contents of an ISO 9660 cdrom image:
83960b4ad09SPeter Avalos.Dl Nm Fl tf Pa image.iso
84060b4ad09SPeter Avalos.Pp
84160b4ad09SPeter AvalosTo move file hierarchies, invoke
84260b4ad09SPeter Avalos.Nm
84360b4ad09SPeter Avalosas
84460b4ad09SPeter Avalos.Dl Nm Fl cf Pa - Fl C Pa srcdir\ . | Nm Fl xpf Pa - Fl C Pa destdir
84560b4ad09SPeter Avalosor more traditionally
84660b4ad09SPeter Avalos.Dl cd srcdir \&; Nm Fl cf Pa -\ . | ( cd destdir \&; Nm Fl xpf Pa - )
84760b4ad09SPeter Avalos.Pp
84860b4ad09SPeter AvalosIn create mode, the list of files and directories to be archived
84960b4ad09SPeter Avaloscan also include directory change instructions of the form
85060b4ad09SPeter Avalos.Cm -C Ns Pa foo/baz
85160b4ad09SPeter Avalosand archive inclusions of the form
85260b4ad09SPeter Avalos.Cm @ Ns Pa archive-file .
85360b4ad09SPeter AvalosFor example, the command line
85460b4ad09SPeter Avalos.Dl Nm Fl c Fl f Pa new.tar Pa foo1 Cm @ Ns Pa old.tgz Cm -C Ns Pa /tmp Pa foo2
85560b4ad09SPeter Avaloswill create a new archive
85660b4ad09SPeter Avalos.Pa new.tar .
85760b4ad09SPeter Avalos.Nm
85860b4ad09SPeter Avaloswill read the file
85960b4ad09SPeter Avalos.Pa foo1
86060b4ad09SPeter Avalosfrom the current directory and add it to the output archive.
86160b4ad09SPeter AvalosIt will then read each entry from
86260b4ad09SPeter Avalos.Pa old.tgz
86360b4ad09SPeter Avalosand add those entries to the output archive.
86460b4ad09SPeter AvalosFinally, it will switch to the
86560b4ad09SPeter Avalos.Pa /tmp
86660b4ad09SPeter Avalosdirectory and add
86760b4ad09SPeter Avalos.Pa foo2
86860b4ad09SPeter Avalosto the output archive.
86960b4ad09SPeter Avalos.Pp
87060b4ad09SPeter AvalosAn input file in
87160b4ad09SPeter Avalos.Xr mtree 5
87260b4ad09SPeter Avalosformat can be used to create an output archive with arbitrary ownership,
87360b4ad09SPeter Avalospermissions, or names that differ from existing data on disk:
87460b4ad09SPeter Avalos.Pp
875*6b384f39SPeter Avalos.Bd -literal -offset indent
876*6b384f39SPeter Avalos$ cat input.mtree
877*6b384f39SPeter Avalos#mtree
878*6b384f39SPeter Avalosusr/bin uid=0 gid=0 mode=0755 type=dir
879*6b384f39SPeter Avalosusr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
880*6b384f39SPeter Avalos$ tar -cvf output.tar @input.mtree
881*6b384f39SPeter Avalos.Ed
88260b4ad09SPeter Avalos.Pp
88360b4ad09SPeter AvalosThe
884c09f92d2SPeter Avalos.Fl Fl newer
88560b4ad09SPeter Avalosand
886c09f92d2SPeter Avalos.Fl Fl newer-mtime
88760b4ad09SPeter Avalosswitches accept a variety of common date and time specifications, including
88860b4ad09SPeter Avalos.Dq 12 Mar 2005 7:14:29pm ,
88960b4ad09SPeter Avalos.Dq 2005-03-12 19:14 ,
89060b4ad09SPeter Avalos.Dq 5 minutes ago ,
89160b4ad09SPeter Avalosand
89260b4ad09SPeter Avalos.Dq 19:14 PST May 1 .
8938029ab02SPeter Avalos.Pp
8948029ab02SPeter AvalosThe
895c09f92d2SPeter Avalos.Fl Fl options
8968029ab02SPeter Avalosargument can be used to control various details of archive generation
8978029ab02SPeter Avalosor reading.
8988029ab02SPeter AvalosFor example, you can generate mtree output which only contains
8998029ab02SPeter Avalos.Cm type , Cm time ,
9008029ab02SPeter Avalosand
9018029ab02SPeter Avalos.Cm uid
9028029ab02SPeter Avaloskeywords:
903c09f92d2SPeter Avalos.Dl Nm Fl cf Pa file.tar Fl Fl format=mtree Fl Fl options='!all,type,time,uid' Pa dir
9048029ab02SPeter Avalosor you can set the compression level used by gzip or xz compression:
905c09f92d2SPeter Avalos.Dl Nm Fl czf Pa file.tar Fl Fl options='compression-level=9' .
9068029ab02SPeter AvalosFor more details, see the explanation of the
9078029ab02SPeter Avalos.Fn archive_read_set_options
9088029ab02SPeter Avalosand
9098029ab02SPeter Avalos.Fn archive_write_set_options
9108029ab02SPeter AvalosAPI calls that are described in
9118029ab02SPeter Avalos.Xr archive_read 3
9128029ab02SPeter Avalosand
9138029ab02SPeter Avalos.Xr archive_write 3 .
91460b4ad09SPeter Avalos.Sh COMPATIBILITY
91560b4ad09SPeter AvalosThe bundled-arguments format is supported for compatibility
91660b4ad09SPeter Avaloswith historic implementations.
91760b4ad09SPeter AvalosIt consists of an initial word (with no leading - character) in which
91860b4ad09SPeter Avaloseach character indicates an option.
91960b4ad09SPeter AvalosArguments follow as separate words.
92060b4ad09SPeter AvalosThe order of the arguments must match the order
92160b4ad09SPeter Avalosof the corresponding characters in the bundled command word.
92260b4ad09SPeter AvalosFor example,
92360b4ad09SPeter Avalos.Dl Nm Cm tbf 32 Pa file.tar
92460b4ad09SPeter Avalosspecifies three flags
92560b4ad09SPeter Avalos.Cm t ,
92660b4ad09SPeter Avalos.Cm b ,
92760b4ad09SPeter Avalosand
92860b4ad09SPeter Avalos.Cm f .
92960b4ad09SPeter AvalosThe
93060b4ad09SPeter Avalos.Cm b
93160b4ad09SPeter Avalosand
93260b4ad09SPeter Avalos.Cm f
93360b4ad09SPeter Avalosflags both require arguments,
93460b4ad09SPeter Avalosso there must be two additional items
93560b4ad09SPeter Avaloson the command line.
93660b4ad09SPeter AvalosThe
93760b4ad09SPeter Avalos.Ar 32
93860b4ad09SPeter Avalosis the argument to the
93960b4ad09SPeter Avalos.Cm b
94060b4ad09SPeter Avalosflag, and
94160b4ad09SPeter Avalos.Ar file.tar
94260b4ad09SPeter Avalosis the argument to the
94360b4ad09SPeter Avalos.Cm f
94460b4ad09SPeter Avalosflag.
94560b4ad09SPeter Avalos.Pp
94660b4ad09SPeter AvalosThe mode options c, r, t, u, and x and the options
94760b4ad09SPeter Avalosb, f, l, m, o, v, and w comply with SUSv2.
94860b4ad09SPeter Avalos.Pp
94960b4ad09SPeter AvalosFor maximum portability, scripts that invoke
95060b4ad09SPeter Avalos.Nm tar
95160b4ad09SPeter Avalosshould use the bundled-argument format above, should limit
95260b4ad09SPeter Avalosthemselves to the
95360b4ad09SPeter Avalos.Cm c ,
95460b4ad09SPeter Avalos.Cm t ,
95560b4ad09SPeter Avalosand
95660b4ad09SPeter Avalos.Cm x
95760b4ad09SPeter Avalosmodes, and the
95860b4ad09SPeter Avalos.Cm b ,
95960b4ad09SPeter Avalos.Cm f ,
96060b4ad09SPeter Avalos.Cm m ,
96160b4ad09SPeter Avalos.Cm v ,
96260b4ad09SPeter Avalosand
96360b4ad09SPeter Avalos.Cm w
96460b4ad09SPeter Avalosoptions.
96560b4ad09SPeter Avalos.Pp
9668029ab02SPeter AvalosAdditional long options are provided to improve compatibility with other
9678029ab02SPeter Avalostar implementations.
96860b4ad09SPeter Avalos.Sh SECURITY
96960b4ad09SPeter AvalosCertain security issues are common to many archiving programs, including
97060b4ad09SPeter Avalos.Nm .
97160b4ad09SPeter AvalosIn particular, carefully-crafted archives can request that
97260b4ad09SPeter Avalos.Nm
97360b4ad09SPeter Avalosextract files to locations outside of the target directory.
97460b4ad09SPeter AvalosThis can potentially be used to cause unwitting users to overwrite
97560b4ad09SPeter Avalosfiles they did not intend to overwrite.
97660b4ad09SPeter AvalosIf the archive is being extracted by the superuser, any file
97760b4ad09SPeter Avaloson the system can potentially be overwritten.
97860b4ad09SPeter AvalosThere are three ways this can happen.
97960b4ad09SPeter AvalosAlthough
98060b4ad09SPeter Avalos.Nm
98160b4ad09SPeter Avaloshas mechanisms to protect against each one,
98260b4ad09SPeter Avalossavvy users should be aware of the implications:
98360b4ad09SPeter Avalos.Bl -bullet -width indent
98460b4ad09SPeter Avalos.It
98560b4ad09SPeter AvalosArchive entries can have absolute pathnames.
98660b4ad09SPeter AvalosBy default,
98760b4ad09SPeter Avalos.Nm
98860b4ad09SPeter Avalosremoves the leading
98960b4ad09SPeter Avalos.Pa /
99060b4ad09SPeter Avaloscharacter from filenames before restoring them to guard against this problem.
99160b4ad09SPeter Avalos.It
99260b4ad09SPeter AvalosArchive entries can have pathnames that include
99360b4ad09SPeter Avalos.Pa ..
99460b4ad09SPeter Avaloscomponents.
99560b4ad09SPeter AvalosBy default,
99660b4ad09SPeter Avalos.Nm
99760b4ad09SPeter Avaloswill not extract files containing
99860b4ad09SPeter Avalos.Pa ..
99960b4ad09SPeter Avaloscomponents in their pathname.
100060b4ad09SPeter Avalos.It
100160b4ad09SPeter AvalosArchive entries can exploit symbolic links to restore
100260b4ad09SPeter Avalosfiles to other directories.
100360b4ad09SPeter AvalosAn archive can restore a symbolic link to another directory,
100460b4ad09SPeter Avalosthen use that link to restore a file into that directory.
100560b4ad09SPeter AvalosTo guard against this,
100660b4ad09SPeter Avalos.Nm
100760b4ad09SPeter Avaloschecks each extracted path for symlinks.
100860b4ad09SPeter AvalosIf the final path element is a symlink, it will be removed
100960b4ad09SPeter Avalosand replaced with the archive entry.
101060b4ad09SPeter AvalosIf
101160b4ad09SPeter Avalos.Fl U
101260b4ad09SPeter Avalosis specified, any intermediate symlink will also be unconditionally removed.
101360b4ad09SPeter AvalosIf neither
101460b4ad09SPeter Avalos.Fl U
101560b4ad09SPeter Avalosnor
101660b4ad09SPeter Avalos.Fl P
101760b4ad09SPeter Avalosis specified,
101860b4ad09SPeter Avalos.Nm
101960b4ad09SPeter Avaloswill refuse to extract the entry.
102060b4ad09SPeter Avalos.El
102160b4ad09SPeter AvalosTo protect yourself, you should be wary of any archives that
102260b4ad09SPeter Avaloscome from untrusted sources.
102360b4ad09SPeter AvalosYou should examine the contents of an archive with
102460b4ad09SPeter Avalos.Dl Nm Fl tf Pa filename
102560b4ad09SPeter Avalosbefore extraction.
102660b4ad09SPeter AvalosYou should use the
102760b4ad09SPeter Avalos.Fl k
102860b4ad09SPeter Avalosoption to ensure that
102960b4ad09SPeter Avalos.Nm
103060b4ad09SPeter Avaloswill not overwrite any existing files or the
103160b4ad09SPeter Avalos.Fl U
103260b4ad09SPeter Avalosoption to remove any pre-existing files.
103360b4ad09SPeter AvalosYou should generally not extract archives while running with super-user
103460b4ad09SPeter Avalosprivileges.
103560b4ad09SPeter AvalosNote that the
103660b4ad09SPeter Avalos.Fl P
103760b4ad09SPeter Avalosoption to
103860b4ad09SPeter Avalos.Nm
103960b4ad09SPeter Avalosdisables the security checks above and allows you to extract
104060b4ad09SPeter Avalosan archive while preserving any absolute pathnames,
104160b4ad09SPeter Avalos.Pa ..
104260b4ad09SPeter Avaloscomponents, or symlinks to other directories.
104360b4ad09SPeter Avalos.Sh SEE ALSO
104460b4ad09SPeter Avalos.Xr bzip2 1 ,
104560b4ad09SPeter Avalos.Xr compress 1 ,
104660b4ad09SPeter Avalos.Xr cpio 1 ,
104760b4ad09SPeter Avalos.Xr gzip 1 ,
104860b4ad09SPeter Avalos.Xr mt 1 ,
104960b4ad09SPeter Avalos.Xr pax 1 ,
105060b4ad09SPeter Avalos.Xr shar 1 ,
1051c09f92d2SPeter Avalos.Xr xz 1 ,
105260b4ad09SPeter Avalos.Xr libarchive 3 ,
105360b4ad09SPeter Avalos.Xr libarchive-formats 5 ,
105460b4ad09SPeter Avalos.Xr tar 5
105560b4ad09SPeter Avalos.Sh STANDARDS
105660b4ad09SPeter AvalosThere is no current POSIX standard for the tar command; it appeared
105760b4ad09SPeter Avalosin
105860b4ad09SPeter Avalos.St -p1003.1-96
105960b4ad09SPeter Avalosbut was dropped from
106060b4ad09SPeter Avalos.St -p1003.1-2001 .
1061c09f92d2SPeter AvalosThe options supported by this implementation were developed by surveying a
106260b4ad09SPeter Avalosnumber of existing tar implementations as well as the old POSIX specification
106360b4ad09SPeter Avalosfor tar and the current POSIX specification for pax.
106460b4ad09SPeter Avalos.Pp
106560b4ad09SPeter AvalosThe ustar and pax interchange file formats are defined by
106660b4ad09SPeter Avalos.St -p1003.1-2001
106760b4ad09SPeter Avalosfor the pax command.
106860b4ad09SPeter Avalos.Sh HISTORY
106960b4ad09SPeter AvalosA
107060b4ad09SPeter Avalos.Nm tar
107160b4ad09SPeter Avaloscommand appeared in Seventh Edition Unix, which was released in January, 1979.
107260b4ad09SPeter AvalosThere have been numerous other implementations,
107360b4ad09SPeter Avalosmany of which extended the file format.
107460b4ad09SPeter AvalosJohn Gilmore's
107560b4ad09SPeter Avalos.Nm pdtar
107660b4ad09SPeter Avalospublic-domain implementation (circa November, 1987)
107760b4ad09SPeter Avaloswas quite influential, and formed the basis of GNU tar.
107860b4ad09SPeter AvalosGNU tar was included as the standard system tar
107960b4ad09SPeter Avalosin
108060b4ad09SPeter Avalos.Fx
108160b4ad09SPeter Avalosbeginning with
108260b4ad09SPeter Avalos.Fx 1.0 .
108360b4ad09SPeter Avalos.Pp
108460b4ad09SPeter AvalosThis is a complete re-implementation based on the
108560b4ad09SPeter Avalos.Xr libarchive 3
108660b4ad09SPeter Avaloslibrary.
1087c09f92d2SPeter AvalosIt was first released with
1088c09f92d2SPeter Avalos.Fx 5.4
1089c09f92d2SPeter Avalosin May, 2005.
109060b4ad09SPeter Avalos.Sh BUGS
109160b4ad09SPeter AvalosThis program follows
109260b4ad09SPeter Avalos.St -p1003.1-96
109360b4ad09SPeter Avalosfor the definition of the
109460b4ad09SPeter Avalos.Fl l
109560b4ad09SPeter Avalosoption.
109660b4ad09SPeter AvalosNote that GNU tar prior to version 1.15 treated
109760b4ad09SPeter Avalos.Fl l
109860b4ad09SPeter Avalosas a synonym for the
1099c09f92d2SPeter Avalos.Fl Fl one-file-system
110060b4ad09SPeter Avalosoption.
110160b4ad09SPeter Avalos.Pp
110260b4ad09SPeter AvalosThe
110360b4ad09SPeter Avalos.Fl C Pa dir
110460b4ad09SPeter Avalosoption may differ from historic implementations.
110560b4ad09SPeter Avalos.Pp
110660b4ad09SPeter AvalosAll archive output is written in correctly-sized blocks, even
110760b4ad09SPeter Avalosif the output is being compressed.
110860b4ad09SPeter AvalosWhether or not the last output block is padded to a full
110960b4ad09SPeter Avalosblock size varies depending on the format and the
111060b4ad09SPeter Avalosoutput device.
111160b4ad09SPeter AvalosFor tar and cpio formats, the last block of output is padded
111260b4ad09SPeter Avalosto a full block size if the output is being
111360b4ad09SPeter Avaloswritten to standard output or to a character or block device such as
111460b4ad09SPeter Avalosa tape drive.
111560b4ad09SPeter AvalosIf the output is being written to a regular file, the last block
111660b4ad09SPeter Avaloswill not be padded.
111760b4ad09SPeter AvalosMany compressors, including
111860b4ad09SPeter Avalos.Xr gzip 1
111960b4ad09SPeter Avalosand
112060b4ad09SPeter Avalos.Xr bzip2 1 ,
112160b4ad09SPeter Avaloscomplain about the null padding when decompressing an archive created by
112260b4ad09SPeter Avalos.Nm ,
112360b4ad09SPeter Avalosalthough they still extract it correctly.
112460b4ad09SPeter Avalos.Pp
112560b4ad09SPeter AvalosThe compression and decompression is implemented internally, so
112660b4ad09SPeter Avalosthere may be insignificant differences between the compressed output
112760b4ad09SPeter Avalosgenerated by
112860b4ad09SPeter Avalos.Dl Nm Fl czf Pa - file
112960b4ad09SPeter Avalosand that generated by
113060b4ad09SPeter Avalos.Dl Nm Fl cf Pa - file | Nm gzip
113160b4ad09SPeter Avalos.Pp
113260b4ad09SPeter AvalosThe default should be to read and write archives to the standard I/O paths,
113360b4ad09SPeter Avalosbut tradition (and POSIX) dictates otherwise.
113460b4ad09SPeter Avalos.Pp
113560b4ad09SPeter AvalosThe
113660b4ad09SPeter Avalos.Cm r
113760b4ad09SPeter Avalosand
113860b4ad09SPeter Avalos.Cm u
113960b4ad09SPeter Avalosmodes require that the archive be uncompressed
114060b4ad09SPeter Avalosand located in a regular file on disk.
114160b4ad09SPeter AvalosOther archives can be modified using
114260b4ad09SPeter Avalos.Cm c
114360b4ad09SPeter Avalosmode with the
114460b4ad09SPeter Avalos.Pa @archive-file
114560b4ad09SPeter Avalosextension.
114660b4ad09SPeter Avalos.Pp
114760b4ad09SPeter AvalosTo archive a file called
114860b4ad09SPeter Avalos.Pa @foo
114960b4ad09SPeter Avalosor
115060b4ad09SPeter Avalos.Pa -foo
115160b4ad09SPeter Avalosyou must specify it as
115260b4ad09SPeter Avalos.Pa ./@foo
115360b4ad09SPeter Avalosor
115460b4ad09SPeter Avalos.Pa ./-foo ,
115560b4ad09SPeter Avalosrespectively.
115660b4ad09SPeter Avalos.Pp
115760b4ad09SPeter AvalosIn create mode, a leading
115860b4ad09SPeter Avalos.Pa ./
115960b4ad09SPeter Avalosis always removed.
116060b4ad09SPeter AvalosA leading
116160b4ad09SPeter Avalos.Pa /
116260b4ad09SPeter Avalosis stripped unless the
116360b4ad09SPeter Avalos.Fl P
116460b4ad09SPeter Avalosoption is specified.
116560b4ad09SPeter Avalos.Pp
116660b4ad09SPeter AvalosThere needs to be better support for file selection on both create
116760b4ad09SPeter Avalosand extract.
116860b4ad09SPeter Avalos.Pp
1169*6b384f39SPeter AvalosThere is not yet any support for multi-volume archives.
117060b4ad09SPeter Avalos.Pp
117160b4ad09SPeter AvalosConverting between dissimilar archive formats (such as tar and cpio) using the
117260b4ad09SPeter Avalos.Cm @ Ns Pa -
117360b4ad09SPeter Avalosconvention can cause hard link information to be lost.
117460b4ad09SPeter Avalos(This is a consequence of the incompatible ways that different archive
117560b4ad09SPeter Avalosformats store hardlink information.)
1176