1 <!-- Creator : groff version 1.22.3 -->
2 <!-- CreationDate: Sat Feb 25 11:22:08 2017 -->
3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4 "http://www.w3.org/TR/html4/loose.dtd">
7 <meta name="generator" content="groff -Thtml, see www.gnu.org">
8 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
9 <meta name="Content-Style" content="text/css">
10 <style type="text/css">
11 p { margin-top: 0; margin-bottom: 0; vertical-align: top }
12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
13 table { margin-top: 0; margin-bottom: 0; vertical-align: top }
14 h1 { text-align: center }
23 <p>TAR(1) BSD General Commands Manual TAR(1)</p>
25 <p style="margin-top: 1em"><b>NAME</b></p>
27 <p style="margin-left:6%;"><b>tar</b> — manipulate
30 <p style="margin-top: 1em"><b>SYNOPSIS</b></p>
32 <p style="margin-left:12%;"><b>tar</b>
33 [<i>bundled-flags </i>⟨</p>
35 <p>args ⟩ ] [⟨ <i><br>
36 file</i> ⟩ | ⟨ <i><br>
37 pattern</i> ⟩ ...]</p>
39 <p style="margin-left:12%;"><b>tar</b> {<b>−c</b>}
41 [<i>files </i>| <i>directories</i>] <b><br>
42 tar</b> {<b>−r </b>| <b>−u</b>}
43 <b>−f</b> <i>archive-file</i> [<i>options</i>]
44 [<i>files </i>| <i>directories</i>] <b><br>
45 tar</b> {<b>−t </b>| <b>−x</b>}
46 [<i>options</i>] [<i>patterns</i>]</p>
48 <p style="margin-top: 1em"><b>DESCRIPTION</b></p>
50 <p style="margin-left:6%;"><b>tar</b> creates and
51 manipulates streaming archive files. This implementation can
52 extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip,
53 and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
54 zip, 7-zip, and shar archives.</p>
56 <p style="margin-left:6%; margin-top: 1em">The first
57 synopsis form shows a ‘‘bundled’’
58 option word. This usage is provided for compatibility with
59 historical implementations. See COMPATIBILITY below for
62 <p style="margin-left:6%; margin-top: 1em">The other
63 synopsis forms show the preferred usage. The first option to
64 <b>tar</b> is a mode indicator from the following list:</p>
66 <p><b>−c</b></p>
68 <p style="margin-left:17%; margin-top: 1em">Create a new
69 archive containing the specified items. The long option form
70 is <b>−−create</b>.</p>
72 <p><b>−r</b></p>
74 <p style="margin-left:17%; margin-top: 1em">Like
75 <b>−c</b>, but new entries are appended to the
76 archive. Note that this only works on uncompressed archives
77 stored in regular files. The <b>−f</b> option is
78 required. The long option form is
79 <b>−−append</b>.</p>
81 <p><b>−t</b></p>
83 <p style="margin-left:17%; margin-top: 1em">List archive
84 contents to stdout. The long option form is
85 <b>−−list</b>.</p>
87 <p><b>−u</b></p>
89 <p style="margin-left:17%; margin-top: 1em">Like
90 <b>−r</b>, but new entries are added only if they have
91 a modification date newer than the corresponding entry in
92 the archive. Note that this only works on uncompressed
93 archives stored in regular files. The <b>−f</b> option
94 is required. The long form is
95 <b>−−update</b>.</p>
97 <p><b>−x</b></p>
99 <p style="margin-left:17%; margin-top: 1em">Extract to disk
100 from the archive. If a file with the same name appears more
101 than once in the archive, each copy will be extracted, with
102 later copies overwriting (replacing) earlier copies. The
103 long option form is <b>−−extract</b>.</p>
105 <p style="margin-left:6%; margin-top: 1em">In
106 <b>−c</b>, <b>−r</b>, or <b>−u</b> mode,
107 each specified file or directory is added to the archive in
108 the order specified on the command line. By default, the
109 contents of each directory are also archived.</p>
111 <p style="margin-left:6%; margin-top: 1em">In extract or
112 list mode, the entire command line is read and parsed before
113 the archive is opened. The pathnames or patterns on the
114 command line indicate which items in the archive should be
115 processed. Patterns are shell-style globbing patterns as
116 documented in tcsh(1).</p>
118 <p style="margin-top: 1em"><b>OPTIONS</b></p>
120 <p style="margin-left:6%;">Unless specifically stated
121 otherwise, options are applicable in all operating
124 <p style="margin-top: 1em"><b>@</b><i>archive</i></p>
126 <p style="margin-left:17%;">(c and r modes only) The
127 specified archive is opened and the entries in it will be
128 appended to the current archive. As a simple example,</p>
130 <p style="margin-left:24%;"><b>tar −c −f</b>
131 <i>- newfile</i> <b>@</b><i>original.tar</i></p>
133 <p style="margin-left:17%;">writes a new archive to
134 standard output containing a file <i>newfile</i> and all of
135 the entries from <i>original.tar</i>. In contrast,</p>
137 <p style="margin-left:24%;"><b>tar −c −f</b>
138 <i>- newfile original.tar</i></p>
140 <p style="margin-left:17%;">creates a new archive with only
141 two entries. Similarly,</p>
143 <p style="margin-left:24%;"><b>tar −czf</b> <i>-</i>
144 <b>−−format pax @</b><i>-</i></p>
146 <p style="margin-left:17%;">reads an archive from standard
147 input (whose format will be determined automatically) and
148 converts it into a gzip-compressed pax-format archive on
149 stdout. In this way, <b>tar</b> can be used to convert
150 archives from one format to another.</p>
152 <p style="margin-top: 1em"><b>−a</b>,
153 <b>−−auto-compress</b></p>
155 <p style="margin-left:17%;">(c mode only) Use the archive
156 suffix to decide a set of the format and the compressions.
157 As a simple example,</p>
159 <p style="margin-left:24%;"><b>tar −a −cf</b>
160 <i>archive.tgz source.c source.h</i></p>
162 <p style="margin-left:17%;">creates a new archive with
163 restricted pax format and gzip compression,</p>
165 <p style="margin-left:24%;"><b>tar −a −cf</b>
166 <i>archive.tar.bz2.uu source.c source.h</i></p>
168 <p style="margin-left:17%;">creates a new archive with
169 restricted pax format and bzip2 compression and uuencode
172 <p style="margin-left:24%;"><b>tar −a −cf</b>
173 <i>archive.zip source.c source.h</i></p>
175 <p style="margin-left:17%;">creates a new archive with zip
178 <p style="margin-left:24%;"><b>tar −a −jcf</b>
179 <i>archive.tgz source.c source.h</i></p>
181 <p style="margin-left:17%;">ignores the
182 ‘‘-j’’ option, and creates a new
183 archive with restricted pax format and gzip compression,</p>
185 <p style="margin-left:24%;"><b>tar −a −jcf</b>
186 <i>archive.xxx source.c source.h</i></p>
188 <p style="margin-left:17%;">if it is unknown suffix or no
189 suffix, creates a new archive with restricted pax format and
190 bzip2 compression.</p>
192 <p style="margin-top: 1em"><b>−−acls</b></p>
194 <p style="margin-left:17%; margin-top: 1em">(c, r, u, x
195 modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This
196 is the reverse of <b>−−no-acls</b> and the
197 default behavior in c, r, and u modes (except Mac OS X) or
198 if <b>tar</b> is run in x mode as root. On Mac OS X this
199 option translates extended ACLs to NFSv4 ACLs. To store
200 extended ACLs the <b>−−mac-metadata</b> option
203 <p style="margin-top: 1em"><b>−B</b>,
204 <b>−−read-full-blocks</b></p>
206 <p style="margin-left:17%;">Ignored for compatibility with
207 other tar(1) implementations.</p>
209 <p style="margin-top: 1em"><b>−b</b>
210 <i>blocksize</i>, <b>−−block-size</b>
213 <p style="margin-left:17%;">Specify the block size, in
214 512-byte records, for tape drive I/O. As a rule, this
215 argument is only needed when reading from or writing to tape
216 drives, and usually not even then as the default block size
217 of 20 records (10240 bytes) is very common.</p>
219 <p style="margin-top: 1em"><b>−C</b>
220 <i>directory</i>, <b>−−cd</b> <i>directory</i>,
221 <b>−−directory</b> <i>directory</i></p>
223 <p style="margin-left:17%;">In c and r mode, this changes
224 the directory before adding the following files. In x mode,
225 change directories after opening the archive but before
226 extracting entries from the archive.</p>
228 <p style="margin-top: 1em"><b>−−chroot</b></p>
230 <p style="margin-left:17%;">(x mode only) <b>chroot</b>()
231 to the current directory after processing any
232 <b>−C</b> options and before extracting any files.</p>
235 <p style="margin-top: 1em"><b>−−clear-nochange-fflags</b></p>
237 <p style="margin-left:17%;">(x mode only) Before removing
238 file system objects to replace them, clear platform-specific
239 file flags that might prevent removal.</p>
241 <p style="margin-top: 1em"><b>−−exclude</b>
244 <p style="margin-left:17%;">Do not process files or
245 directories that match the specified pattern. Note that
246 exclusions take precedence over patterns or filenames
247 specified on the command line.</p>
249 <p style="margin-top: 1em"><b>−−fflags</b></p>
251 <p style="margin-left:17%;">(c, r, u, x modes only) Archive
252 or extract file flags. This is the reverse of
253 <b>−−no-fflags</b> and the default behavior in
254 c, r, and u modes or if <b>tar</b> is run in x mode as
257 <p style="margin-top: 1em"><b>−−format</b>
260 <p style="margin-left:17%;">(c, r, u mode only) Use the
261 specified format for the created archive. Supported formats
262 include ‘‘cpio’’,
263 ‘‘pax’’,
264 ‘‘shar’’, and
265 ‘‘ustar’’. Other formats may also be
266 supported; see libarchive-formats(5) for more information
267 about currently-supported formats. In r and u modes, when
268 extending an existing archive, the format specified here
269 must be compatible with the format of the existing archive
272 <p style="margin-top: 1em"><b>−f</b> <i>file</i>,
273 <b>−−file</b> <i>file</i></p>
275 <p style="margin-left:17%;">Read the archive from or write
276 the archive to the specified file. The filename can be
277 <i>-</i> for standard input or standard output. The default
278 varies by system; on FreeBSD, the default is
279 <i>/dev/sa0</i>; on Linux, the default is
282 <p style="margin-top: 1em"><b>−−gid</b>
285 <p style="margin-left:17%;">Use the provided group id
286 number. On extract, this overrides the group id in the
287 archive; the group name in the archive will be ignored. On
288 create, this overrides the group id read from disk; if
289 <b>−−gname</b> is not also specified, the group
290 name will be set to match the group id.</p>
292 <p style="margin-top: 1em"><b>−−gname</b>
295 <p style="margin-left:17%;">Use the provided group name. On
296 extract, this overrides the group name in the archive; if
297 the provided group name does not exist on the system, the
298 group id (from the archive or from the
299 <b>−−gid</b> option) will be used instead. On
300 create, this sets the group name that will be stored in the
301 archive; the name will not be verified against the system
304 <p style="margin-top: 1em"><b>−H</b></p>
306 <p style="margin-left:17%; margin-top: 1em">(c and r modes
307 only) Symbolic links named on the command line will be
308 followed; the target of the link will be archived, not the
311 <p style="margin-top: 1em"><b>−h</b></p>
313 <p style="margin-left:17%; margin-top: 1em">(c and r modes
314 only) Synonym for <b>−L</b>.</p>
316 <p style="margin-top: 1em"><b>−I</b></p>
318 <p style="margin-left:17%; margin-top: 1em">Synonym for
321 <p style="margin-top: 1em"><b>−−help</b></p>
323 <p style="margin-left:17%; margin-top: 1em">Show usage.</p>
326 <p style="margin-top: 1em"><b>−−hfsCompression</b></p>
328 <p style="margin-left:17%;">(x mode only) Mac OS X specific
329 (v10.6 or later). Compress extracted regular files with HFS+
333 <p style="margin-top: 1em"><b>−−ignore-zeros</b></p>
335 <p style="margin-left:17%;">An alias of
336 <b>−−options read_concatenated_archives</b> for
337 compatibility with GNU tar.</p>
339 <p style="margin-top: 1em"><b>−−include</b>
342 <p style="margin-left:17%;">Process only files or
343 directories that match the specified pattern. Note that
344 exclusions specified with <b>−−exclude</b> take
345 precedence over inclusions. If no inclusions are explicitly
346 specified, all entries are processed by default. The
347 <b>−−include</b> option is especially useful
348 when filtering archives. For example, the command</p>
350 <p style="margin-left:24%;"><b>tar −c −f</b>
351 <i>new.tar</i> <b>−−include=’*foo*’
352 @</b><i>old.tgz</i></p>
354 <p style="margin-left:17%;">creates a new archive
355 <i>new.tar</i> containing only the entries from
356 <i>old.tgz</i> containing the string ‘foo’.</p>
358 <p style="margin-top: 1em"><b>−J</b>,
359 <b>−−xz</b></p>
361 <p style="margin-left:17%;">(c mode only) Compress the
362 resulting archive with xz(1). In extract or list modes, this
363 option is ignored. Note that, unlike other <b>tar</b>
364 implementations, this implementation recognizes XZ
365 compression automatically when reading archives.</p>
367 <p style="margin-top: 1em"><b>−j</b>,
368 <b>−−bzip</b>, <b>−−bzip2</b>,
369 <b>−−bunzip2</b></p>
371 <p style="margin-left:17%;">(c mode only) Compress the
372 resulting archive with bzip2(1). In extract or list modes,
373 this option is ignored. Note that, unlike other <b>tar</b>
374 implementations, this implementation recognizes bzip2
375 compression automatically when reading archives.</p>
377 <p style="margin-top: 1em"><b>−k</b>,
378 <b>−−keep-old-files</b></p>
380 <p style="margin-left:17%;">(x mode only) Do not overwrite
381 existing files. In particular, if a file appears more than
382 once in an archive, later copies will not overwrite earlier
386 <p style="margin-top: 1em"><b>−−keep-newer-files</b></p>
388 <p style="margin-left:17%;">(x mode only) Do not overwrite
389 existing files that are newer than the versions appearing in
390 the archive being extracted.</p>
392 <p style="margin-top: 1em"><b>−L</b>,
393 <b>−−dereference</b></p>
395 <p style="margin-left:17%;">(c and r modes only) All
396 symbolic links will be followed. Normally, symbolic links
397 are archived as such. With this option, the target of the
398 link will be archived instead.</p>
400 <p style="margin-top: 1em"><b>−l</b>,
401 <b>−−check-links</b></p>
403 <p style="margin-left:17%;">(c and r modes only) Issue a
404 warning message unless all links to each file are
407 <p style="margin-top: 1em"><b>−−lrzip</b></p>
409 <p style="margin-left:17%;">(c mode only) Compress the
410 resulting archive with lrzip(1). In extract or list modes,
411 this option is ignored.</p>
413 <p style="margin-top: 1em"><b>−−lz4</b></p>
415 <p style="margin-left:17%; margin-top: 1em">(c mode only)
416 Compress the archive with lz4-compatible compression before
417 writing it. In input mode, this option is ignored; lz4
418 compression is recognized automatically on input.</p>
420 <p style="margin-top: 1em"><b>−−lzma</b></p>
422 <p style="margin-left:17%; margin-top: 1em">(c mode only)
423 Compress the resulting archive with the original LZMA
424 algorithm. Use of this option is discouraged and new
425 archives should be created with <b>−−xz</b>
426 instead. Note that, unlike other <b>tar</b> implementations,
427 this implementation recognizes LZMA compression
428 automatically when reading archives.</p>
430 <p style="margin-top: 1em"><b>−−lzop</b></p>
432 <p style="margin-left:17%; margin-top: 1em">(c mode only)
433 Compress the resulting archive with lzop(1). In extract or
434 list modes, this option is ignored.</p>
436 <p style="margin-top: 1em"><b>−m</b>,
437 <b>−−modification-time</b></p>
439 <p style="margin-left:17%;">(x mode only) Do not extract
440 modification time. By default, the modification time is set
441 to the time stored in the archive.</p>
444 <p style="margin-top: 1em"><b>−−mac-metadata</b></p>
446 <p style="margin-left:17%;">(c, r, u and x mode only) Mac
447 OS X specific. Archive or extract extended ACLs and extended
448 attributes using copyfile(3) in AppleDouble format. This is
449 the reverse of <b>−−no-mac-metadata</b>. and the
450 default behavior in c, r, and u modes or if <b>tar</b> is
451 run in x mode as root.</p>
453 <p style="margin-top: 1em"><b>−n</b>,
454 <b>−−norecurse</b>,
455 <b>−−no-recursion</b></p>
457 <p style="margin-left:17%;">(c, r, u modes only) Do not
458 recursively archive the contents of directories.</p>
460 <p style="margin-top: 1em"><b>−−newer</b>
463 <p style="margin-left:17%;">(c, r, u modes only) Only
464 include files and directories newer than the specified date.
465 This compares ctime entries.</p>
468 <p style="margin-top: 1em"><b>−−newer-mtime</b>
471 <p style="margin-left:17%;">(c, r, u modes only) Like
472 <b>−−newer</b>, except it compares mtime entries
473 instead of ctime entries.</p>
475 <p style="margin-top: 1em"><b>−−newer-than</b>
478 <p style="margin-left:17%;">(c, r, u modes only) Only
479 include files and directories newer than the specified file.
480 This compares ctime entries.</p>
483 <p style="margin-top: 1em"><b>−−newer-mtime-than</b>
486 <p style="margin-left:17%;">(c, r, u modes only) Like
487 <b>−−newer-than</b>, except it compares mtime
488 entries instead of ctime entries.</p>
490 <p style="margin-top: 1em"><b>−−nodump</b></p>
492 <p style="margin-left:17%;">(c and r modes only) Honor the
493 nodump file flag by skipping this file.</p>
496 <p style="margin-top: 1em"><b>−−nopreserveHFSCompression</b></p>
498 <p style="margin-left:17%;">(x mode only) Mac OS X
499 specific(v10.6 or later). Do not compress extracted regular
500 files which were compressed with HFS+ compression before
501 archived. By default, compress the regular files again with
502 HFS+ compression.</p>
504 <p style="margin-top: 1em"><b>−−null</b></p>
506 <p style="margin-left:17%; margin-top: 1em">(use with
507 <b>−I</b> or <b>−T</b>) Filenames or patterns
508 are separated by null characters, not by newlines. This is
509 often used to read filenames output by the
510 <b>−print0</b> option to find(1).</p>
513 <p style="margin-top: 1em"><b>−−no-acls</b></p>
515 <p style="margin-left:17%;">(c, r, u, x modes only) Do not
516 archive or extract POSIX.1e or NFSv4 ACLs. This is the
517 reverse of <b>−−acls</b> and the default
518 behavior if <b>tar</b> is run as non-root in x mode (on Mac
519 OS X also in c, r and u modes).</p>
522 <p style="margin-top: 1em"><b>−−no-fflags</b></p>
524 <p style="margin-left:17%;">(c, r, u, x modes only) Do not
525 archive or extract file flags. This is the reverse of
526 <b>−−fflags</b> and the default behavior if
527 <b>tar</b> is run as non-root in x mode.</p>
530 <p style="margin-top: 1em"><b>−−no-mac-metadata</b></p>
532 <p style="margin-left:17%;">(x mode only) Mac OS X
533 specific. Do not archive or extract ACLs and extended
534 attributes using copyfile(3) in AppleDouble format. This is
535 the reverse of <b>−−mac-metadata</b>. and the
536 default behavior if <b>tar</b> is run as non-root in x
539 <p style="margin-top: 1em"><b>−n</b>,
540 <b>−−norecurse</b>,
541 <b>−−no-recursion</b></p>
544 <p style="margin-top: 1em"><b>−−no-same-owner</b></p>
546 <p style="margin-left:17%;">(x mode only) Do not extract
547 owner and group IDs. This is the reverse of
548 <b>−−same-owner</b> and the default behavior if
549 <b>tar</b> is run as non-root.</p>
552 <p style="margin-top: 1em"><b>−−no-same-permissions</b></p>
554 <p style="margin-left:17%;">(x mode only) Do not extract
555 full permissions (SGID, SUID, sticky bit, ACLs, extended
556 attributes or extended file flags). This is the reverse of
557 <b>−p</b> and the default behavior if <b>tar</b> is
558 run as non-root and can be overridden by also specifying
559 <b>−−acls</b>, <b>−−fflags</b>,
560 <b>−−mac-metadata, −−same-owner</b>,
561 <b>−−same-permissions</b> and
562 <b>−−xattrs</b>.</p>
565 <p style="margin-top: 1em"><b>−−no-xattrs</b></p>
567 <p style="margin-left:17%;">(c, r, u, x modes only) Do not
568 archive or extract extended attributes. This is the reverse
569 of <b>−−xattrs</b> and the default behavior if
570 <b>tar</b> is run as non-root in x mode.</p>
573 <p style="margin-top: 1em"><b>−−numeric-owner</b></p>
575 <p style="margin-left:17%;">This is equivalent to
576 <b>−−uname</b> ""
577 <b>−−gname</b> "". On extract, it
578 causes user and group names in the archive to be ignored in
579 favor of the numeric user and group ids. On create, it
580 causes user and group names to not be stored in the
583 <p style="margin-top: 1em"><b>−O</b>,
584 <b>−−to-stdout</b></p>
586 <p style="margin-left:17%;">(x, t modes only) In extract
587 (-x) mode, files will be written to standard out rather than
588 being extracted to disk. In list (-t) mode, the file listing
589 will be written to stderr rather than the usual stdout.</p>
591 <p style="margin-top: 1em"><b>−o</b></p>
593 <p style="margin-left:17%; margin-top: 1em">(x mode) Use
594 the user and group of the user running the program rather
595 than those specified in the archive. Note that this has no
596 significance unless <b>−p</b> is specified, and the
597 program is being run by the root user. In this case, the
598 file modes and flags from the archive will be restored, but
599 ACLs or owner information in the archive will be
602 <p style="margin-top: 1em"><b>−o</b></p>
604 <p style="margin-left:17%; margin-top: 1em">(c, r, u mode)
605 A synonym for <b>−−format</b> <i>ustar</i></p>
607 <p style="margin-top: 1em"><b>−−older</b>
610 <p style="margin-left:17%;">(c, r, u modes only) Only
611 include files and directories older than the specified date.
612 This compares ctime entries.</p>
615 <p style="margin-top: 1em"><b>−−older-mtime</b>
618 <p style="margin-left:17%;">(c, r, u modes only) Like
619 <b>−−older</b>, except it compares mtime entries
620 instead of ctime entries.</p>
622 <p style="margin-top: 1em"><b>−−older-than</b>
625 <p style="margin-left:17%;">(c, r, u modes only) Only
626 include files and directories older than the specified file.
627 This compares ctime entries.</p>
630 <p style="margin-top: 1em"><b>−−older-mtime-than</b>
633 <p style="margin-left:17%;">(c, r, u modes only) Like
634 <b>−−older-than</b>, except it compares mtime
635 entries instead of ctime entries.</p>
638 <p style="margin-top: 1em"><b>−−one-file-system</b></p>
640 <p style="margin-left:17%;">(c, r, and u modes) Do not
641 cross mount points.</p>
643 <p style="margin-top: 1em"><b>−−options</b>
646 <p style="margin-left:17%;">Select optional behaviors for
647 particular modules. The argument is a text string containing
648 comma-separated keywords and values. These are passed to the
649 modules that handle particular formats to control how those
650 formats will behave. Each option has one of the following
653 <p><i>key=value</i></p>
655 <p style="margin-left:27%;">The key will be set to the
656 specified value in every module that supports it. Modules
657 that do not support this key will ignore it.</p>
661 <p style="margin-left:27%; margin-top: 1em">The key will be
662 enabled in every module that supports it. This is equivalent
663 to <i>key</i><b>=1</b>.</p>
667 <p style="margin-left:27%; margin-top: 1em">The key will be
668 disabled in every module that supports it.</p>
670 <p><i>module:key=value</i>, <i>module:key</i>,
671 <i>module:!key</i></p>
673 <p style="margin-left:27%;">As above, but the corresponding
674 key and value will be provided only to modules whose name
675 matches <i>module</i>.</p>
677 <p style="margin-left:17%;">The currently supported modules
680 <p><b>iso9660:joliet</b></p>
682 <p style="margin-left:27%;">Support Joliet extensions. This
683 is enabled by default, use <b>!joliet</b> or
684 <b>iso9660:!joliet</b> to disable.</p>
686 <p><b>iso9660:rockridge</b></p>
688 <p style="margin-left:27%;">Support Rock Ridge extensions.
689 This is enabled by default, use <b>!rockridge</b> or
690 <b>iso9660:!rockridge</b> to disable.</p>
692 <p><b>gzip:compression-level</b></p>
694 <p style="margin-left:27%;">A decimal integer from 1 to 9
695 specifying the gzip compression level.</p>
697 <p><b>gzip:timestamp</b></p>
699 <p style="margin-left:27%;">Store timestamp. This is
700 enabled by default, use <b>!timestamp</b> or
701 <b>gzip:!timestamp</b> to disable.</p>
703 <p><b>lrzip:compression</b>=<i>type</i></p>
705 <p style="margin-left:27%;">Use <i>type</i> as compression
706 method. Supported values are bzip2, gzip, lzo (ultra fast),
707 and zpaq (best, extremely slow).</p>
709 <p><b>lrzip:compression-level</b></p>
711 <p style="margin-left:27%;">A decimal integer from 1 to 9
712 specifying the lrzip compression level.</p>
714 <p><b>lz4:compression-level</b></p>
716 <p style="margin-left:27%;">A decimal integer from 1 to 9
717 specifying the lzop compression level.</p>
719 <p><b>lz4:stream-checksum</b></p>
721 <p style="margin-left:27%;">Enable stream checksum. This is
722 by default, use <b>lz4:!stream-checksum</b> to disable.</p>
724 <p><b>lz4:block-checksum</b></p>
726 <p style="margin-left:27%;">Enable block checksum (Disabled
729 <p><b>lz4:block-size</b></p>
731 <p style="margin-left:27%;">A decimal integer from 4 to 7
732 specifying the lz4 compression block size (7 is set by
735 <p><b>lz4:block-dependence</b></p>
737 <p style="margin-left:27%;">Use the previous block of the
738 block being compressed for a compression dictionary to
739 improve compression ratio.</p>
741 <p><b>lzop:compression-level</b></p>
743 <p style="margin-left:27%;">A decimal integer from 1 to 9
744 specifying the lzop compression level.</p>
746 <p><b>xz:compression-level</b></p>
748 <p style="margin-left:27%;">A decimal integer from 0 to 9
749 specifying the xz compression level.</p>
751 <p><b>mtree:</b><i>keyword</i></p>
753 <p style="margin-left:27%;">The mtree writer module allows
754 you to specify which mtree keywords will be included in the
755 output. Supported keywords include: <b>cksum</b>,
756 <b>device</b>, <b>flags</b>, <b>gid</b>, <b>gname</b>,
757 <b>indent</b>, <b>link</b>, <b>md5</b>, <b>mode</b>,
758 <b>nlink</b>, <b>rmd160</b>, <b>sha1</b>, <b>sha256</b>,
759 <b>sha384</b>, <b>sha512</b>, <b>size</b>, <b>time</b>,
760 <b>uid</b>, <b>uname</b>. The default is equivalent to:
761 ‘‘device, flags, gid, gname, link, mode, nlink,
762 size, time, type, uid, uname’’.</p>
764 <p><b>mtree:all</b></p>
766 <p style="margin-left:27%;">Enables all of the above
767 keywords. You can also use <b>mtree:!all</b> to disable all
770 <p><b>mtree:use-set</b></p>
772 <p style="margin-left:27%;">Enable generation of
773 <b>/set</b> lines in the output.</p>
775 <p><b>mtree:indent</b></p>
777 <p style="margin-left:27%;">Produce human-readable output
778 by indenting options and splitting lines to fit into 80
781 <p><b>zip:compression</b>=<i>type</i></p>
783 <p style="margin-left:27%;">Use <i>type</i> as compression
784 method. Supported values are store (uncompressed) and
785 deflate (gzip algorithm).</p>
787 <p><b>zip:encryption</b></p>
789 <p style="margin-left:27%;">Enable encryption using
790 traditional zip encryption.</p>
792 <p><b>zip:encryption</b>=<i>type</i></p>
794 <p style="margin-left:27%;">Use <i>type</i> as encryption
795 type. Supported values are zipcrypt (traditional zip
796 encryption), aes128 (WinZip AES-128 encryption) and aes256
797 (WinZip AES-256 encryption).</p>
799 <p><b>read_concatenated_archives</b></p>
801 <p style="margin-left:27%;">Ignore zeroed blocks in the
802 archive, which occurs when multiple tar archives have been
803 concatenated together. Without this option, only the
804 contents of the first concatenated archive would be read.
805 This option is comparable to the <b>−i</b>,
806 <b>−−ignore-zeros</b> option of GNU tar.</p>
808 <p style="margin-left:17%;">If a provided option is not
809 supported by any module, that is a fatal error.</p>
811 <p style="margin-top: 1em"><b>−P</b>,
812 <b>−−absolute-paths</b></p>
814 <p style="margin-left:17%;">Preserve pathnames. By default,
815 absolute pathnames (those that begin with a / character)
816 have the leading slash removed both when creating archives
817 and extracting from them. Also, <b>tar</b> will refuse to
818 extract archive entries whose pathnames contain <i>..</i> or
819 whose target directory would be altered by a symlink. This
820 option suppresses these behaviors.</p>
822 <p style="margin-top: 1em"><b>−p</b>,
823 <b>−−insecure</b>,
824 <b>−−preserve-permissions</b></p>
826 <p style="margin-left:17%;">(x mode only) Preserve file
827 permissions. Attempt to restore the full permissions,
828 including owner, file modes, ACLs, extended atributes and
829 extended file flags, if available, for each item extracted
830 from the archive. This is the default, if <b>tar</b> is
831 being run by root and can be overridden by also specifying
832 <b>−−no-acls</b>,
833 <b>−−no-fflags</b>,
834 <b>−−no-mac-metadata,
835 −−no-same-owner</b>,
836 <b>−−no-same-permissions</b> and
837 <b>−−no-xattrs</b>.</p>
839 <p style="margin-top: 1em"><b>−−passphrase</b>
840 <i>passphrase</i></p>
842 <p style="margin-left:17%;">The <i>passphrase</i> is used
843 to extract or create an encrypted archive. Currently, zip is
844 the only supported format that supports encryption. You
845 shouldn’t use this option unless you realize how
846 insecure use of this option is.</p>
848 <p style="margin-top: 1em"><b>−−posix</b></p>
850 <p style="margin-left:17%;">(c, r, u mode only) Synonym for
851 <b>−−format</b> <i>pax</i></p>
853 <p style="margin-top: 1em"><b>−q</b>,
854 <b>−−fast-read</b></p>
856 <p style="margin-left:17%;">(x and t mode only) Extract or
857 list only the first archive entry that matches each pattern
858 or filename operand. Exit as soon as each specified pattern
859 or filename has been matched. By default, the archive is
860 always read to the very end, since there can be multiple
861 entries with the same name and, by convention, later entries
862 overwrite earlier entries. This option is provided as a
863 performance optimization.</p>
865 <p style="margin-top: 1em"><b>−S</b></p>
867 <p style="margin-left:17%; margin-top: 1em">(x mode only)
868 Extract files as sparse files. For every block on disk,
869 check first if it contains only NULL bytes and seek over it
870 otherwise. This works similar to the conv=sparse option of
873 <p style="margin-top: 1em"><b>−s</b>
876 <p style="margin-left:17%;">Modify file or archive member
877 names according to <i>pattern</i>. The pattern has the
878 format <i>/old/new/</i>[ghHprRsS] where <i>old</i> is a
879 basic regular expression, <i>new</i> is the replacement
880 string of the matched part, and the optional trailing
881 letters modify how the replacement is handled. If <i>old</i>
882 is not matched, the pattern is skipped. Within <i>new</i>, ~
883 is substituted with the match, \1 to \9 with the content of
884 the corresponding captured group. The optional trailing g
885 specifies that matching should continue after the matched
886 part and stop on the first unmatched pattern. The optional
887 trailing s specifies that the pattern applies to the value
888 of symbolic links. The optional trailing p specifies that
889 after a successful substitution the original path name and
890 the new path name should be printed to standard error.
891 Optional trailing H, R, or S characters suppress
892 substitutions for hardlink targets, regular filenames, or
893 symlink targets, respectively. Optional trailing h, r, or s
894 characters enable substitutions for hardlink targets,
895 regular filenames, or symlink targets, respectively. The
896 default is <i>hrs</i> which applies substitutions to all
897 names. In particular, it is never necessary to specify h, r,
901 <p style="margin-top: 1em"><b>−−same-owner</b></p>
903 <p style="margin-left:17%;">(x mode only) Extract owner and
904 group IDs. This is the reverse of
905 <b>−−no-same-owner</b> and the default behavior
906 if <b>tar</b> is run as root.</p>
909 <p style="margin-top: 1em"><b>−−strip-components</b>
912 <p style="margin-left:17%;">Remove the specified number of
913 leading path elements. Pathnames with fewer elements will be
914 silently skipped. Note that the pathname is edited after
915 checking inclusion/exclusion patterns but before security
918 <p style="margin-top: 1em"><b>−T</b> <i>filename</i>,
919 <b>−−files-from</b> <i>filename</i></p>
921 <p style="margin-left:17%;">In x or t mode, <b>tar</b> will
922 read the list of names to be extracted from <i>filename</i>.
923 In c mode, <b>tar</b> will read names to be archived from
924 <i>filename</i>. The special name
925 ‘‘-C’’ on a line by itself will
926 cause the current directory to be changed to the directory
927 specified on the following line. Names are terminated by
928 newlines unless <b>−−null</b> is specified. Note
929 that <b>−−null</b> also disables the special
930 handling of lines containing ‘‘-C’’.
931 Note: If you are generating lists of files using find(1),
932 you probably want to use <b>−n</b> as well.</p>
934 <p style="margin-top: 1em"><b>−−totals</b></p>
936 <p style="margin-left:17%;">(c, r, u modes only) After
937 archiving all files, print a summary to stderr.</p>
939 <p style="margin-top: 1em"><b>−U</b>,
940 <b>−−unlink</b>,
941 <b>−−unlink-first</b></p>
943 <p style="margin-left:17%;">(x mode only) Unlink files
944 before creating them. This can be a minor performance
945 optimization if most files already exist, but can make
946 things slower if most files do not already exist. This flag
947 also causes <b>tar</b> to remove intervening directory
948 symlinks instead of reporting an error. See the SECURITY
949 section below for more details.</p>
951 <p style="margin-top: 1em"><b>−−uid</b>
954 <p style="margin-left:17%;">Use the provided user id number
955 and ignore the user name from the archive. On create, if
956 <b>−−uname</b> is not also specified, the user
957 name will be set to match the user id.</p>
959 <p style="margin-top: 1em"><b>−−uname</b>
962 <p style="margin-left:17%;">Use the provided user name. On
963 extract, this overrides the user name in the archive; if the
964 provided user name does not exist on the system, it will be
965 ignored and the user id (from the archive or from the
966 <b>−−uid</b> option) will be used instead. On
967 create, this sets the user name that will be stored in the
968 archive; the name is not verified against the system user
972 <p style="margin-top: 1em"><b>−−use-compress-program</b>
975 <p style="margin-left:17%;">Pipe the input (in x or t mode)
976 or the output (in c mode) through <i>program</i> instead of
977 using the builtin compression support.</p>
979 <p style="margin-top: 1em"><b>−v</b>,
980 <b>−−verbose</b></p>
982 <p style="margin-left:17%;">Produce verbose output. In
983 create and extract modes, <b>tar</b> will list each file
984 name as it is read from or written to the archive. In list
985 mode, <b>tar</b> will produce output similar to that of
986 ls(1). An additional <b>−v</b> option will also
987 provide ls-like details in create and extract mode.</p>
990 <p style="margin-top: 1em"><b>−−version</b></p>
992 <p style="margin-left:17%;">Print version of <b>tar</b> and
993 <b>libarchive</b>, and exit.</p>
995 <p style="margin-top: 1em"><b>−w</b>,
996 <b>−−confirmation</b>,
997 <b>−−interactive</b></p>
999 <p style="margin-left:17%;">Ask for confirmation for every
1002 <p style="margin-top: 1em"><b>−X</b> <i>filename</i>,
1003 <b>−−exclude-from</b> <i>filename</i></p>
1005 <p style="margin-left:17%;">Read a list of exclusion
1006 patterns from the specified file. See
1007 <b>−−exclude</b> for more information about the
1008 handling of exclusions.</p>
1010 <p style="margin-top: 1em"><b>−−xattrs</b></p>
1012 <p style="margin-left:17%;">(c, r, u, x modes only) Archive
1013 or extract extended attributes. This is the reverse of
1014 <b>−−no-xattrs</b> and the default behavior in
1015 c, r, and u modes or if <b>tar</b> is run in x mode as
1018 <p style="margin-top: 1em"><b>−y</b></p>
1020 <p style="margin-left:17%; margin-top: 1em">(c mode only)
1021 Compress the resulting archive with bzip2(1). In extract or
1022 list modes, this option is ignored. Note that, unlike other
1023 <b>tar</b> implementations, this implementation recognizes
1024 bzip2 compression automatically when reading archives.</p>
1026 <p style="margin-top: 1em"><b>−Z</b>,
1027 <b>−−compress</b>,
1028 <b>−−uncompress</b></p>
1030 <p style="margin-left:17%;">(c mode only) Compress the
1031 resulting archive with compress(1). In extract or list
1032 modes, this option is ignored. Note that, unlike other
1033 <b>tar</b> implementations, this implementation recognizes
1034 compress compression automatically when reading
1037 <p style="margin-top: 1em"><b>−z</b>,
1038 <b>−−gunzip</b>, <b>−−gzip</b></p>
1040 <p style="margin-left:17%;">(c mode only) Compress the
1041 resulting archive with gzip(1). In extract or list modes,
1042 this option is ignored. Note that, unlike other <b>tar</b>
1043 implementations, this implementation recognizes gzip
1044 compression automatically when reading archives.</p>
1046 <p style="margin-top: 1em"><b>ENVIRONMENT</b></p>
1048 <p style="margin-left:6%;">The following environment
1049 variables affect the execution of <b>tar</b>:</p>
1051 <p style="margin-top: 1em">TAR_READER_OPTIONS</p>
1053 <p style="margin-left:21%;">The default options for format
1054 readers and compression readers. The
1055 <b>−−options</b> option overrides this.</p>
1057 <p style="margin-top: 1em">TAR_WRITER_OPTIONS</p>
1059 <p style="margin-left:21%;">The default options for format
1060 writers and compression writers. The
1061 <b>−−options</b> option overrides this.</p>
1063 <p style="margin-top: 1em">LANG</p>
1065 <p style="margin-left:21%; margin-top: 1em">The locale to
1066 use. See environ(7) for more information.</p>
1068 <p style="margin-top: 1em">TAPE</p>
1070 <p style="margin-left:21%; margin-top: 1em">The default
1071 device. The <b>−f</b> option overrides this. Please
1072 see the description of the <b>−f</b> option above for
1075 <p style="margin-top: 1em">TZ</p>
1077 <p style="margin-left:21%; margin-top: 1em">The timezone to
1078 use when displaying dates. See environ(7) for more
1081 <p style="margin-top: 1em"><b>EXIT STATUS</b></p>
1083 <p style="margin-left:6%;">The <b>tar</b> utility
1084 exits 0 on success, and >0 if an error
1087 <p style="margin-top: 1em"><b>EXAMPLES</b></p>
1089 <p style="margin-left:6%;">The following creates a new
1090 archive called <i>file.tar.gz</i> that contains two files
1091 <i>source.c</i> and <i>source.h</i>:</p>
1093 <p style="margin-left:14%;"><b>tar −czf</b>
1094 <i>file.tar.gz source.c source.h</i></p>
1096 <p style="margin-left:6%; margin-top: 1em">To view a
1097 detailed table of contents for this archive:</p>
1099 <p style="margin-left:14%;"><b>tar −tvf</b>
1100 <i>file.tar.gz</i></p>
1102 <p style="margin-left:6%; margin-top: 1em">To extract all
1103 entries from the archive on the default tape drive:</p>
1105 <p style="margin-left:14%;"><b>tar −x</b></p>
1107 <p style="margin-left:6%; margin-top: 1em">To examine the
1108 contents of an ISO 9660 cdrom image:</p>
1110 <p style="margin-left:14%;"><b>tar −tf</b>
1111 <i>image.iso</i></p>
1113 <p style="margin-left:6%; margin-top: 1em">To move file
1114 hierarchies, invoke <b>tar</b> as</p>
1116 <p style="margin-left:14%;"><b>tar −cf</b> <i>-</i>
1117 <b>−C</b> <i>srcdir .</i> | <b>tar −xpf</b>
1118 <i>-</i> <b>−C</b> <i>destdir</i></p>
1120 <p style="margin-left:6%;">or more traditionally</p>
1122 <p style="margin-left:14%;">cd srcdir ; <b>tar
1123 −cf</b> <i>- .</i> | (<i>cd destdir ;</i> <b>tar
1124 −xpf</b> <i>-</i>)</p>
1126 <p style="margin-left:6%; margin-top: 1em">In create mode,
1127 the list of files and directories to be archived can also
1128 include directory change instructions of the form
1129 <b>-C</b><i>foo/baz</i> and archive inclusions of the form
1130 <b>@</b><i>archive-file</i>. For example, the command
1133 <p style="margin-left:14%;"><b>tar −c −f</b>
1134 <i>new.tar foo1</i> <b>@</b><i>old.tgz</i> <b>-C</b><i>/tmp
1137 <p style="margin-left:6%;">will create a new archive
1138 <i>new.tar</i>. <b>tar</b> will read the file <i>foo1</i>
1139 from the current directory and add it to the output archive.
1140 It will then read each entry from <i>old.tgz</i> and add
1141 those entries to the output archive. Finally, it will switch
1142 to the <i>/tmp</i> directory and add <i>foo2</i> to the
1145 <p style="margin-left:6%; margin-top: 1em">An input file in
1146 mtree(5) format can be used to create an output archive with
1147 arbitrary ownership, permissions, or names that differ from
1148 existing data on disk:</p>
1150 <p style="margin-left:14%; margin-top: 1em">$ cat
1153 usr/bin uid=0 gid=0 mode=0755 type=dir <br>
1154 usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls <br>
1155 $ tar -cvf output.tar @input.mtree</p>
1157 <p style="margin-left:6%; margin-top: 1em">The
1158 <b>−−newer</b> and
1159 <b>−−newer-mtime</b> switches accept a variety
1160 of common date and time specifications, including
1161 ‘‘12 Mar 2005 7:14:29pm’’,
1162 ‘‘2005-03-12 19:14’’,
1163 ‘‘5 minutes ago’’, and
1164 ‘‘19:14 PST May 1’’.</p>
1166 <p style="margin-left:6%; margin-top: 1em">The
1167 <b>−−options</b> argument can be used to control
1168 various details of archive generation or reading. For
1169 example, you can generate mtree output which only contains
1170 <b>type</b>, <b>time</b>, and <b>uid</b> keywords:</p>
1172 <p style="margin-left:14%;"><b>tar −cf</b>
1173 <i>file.tar</i> <b>−−format=mtree
1174 −−options=’!all,type,time,uid’</b>
1177 <p style="margin-left:6%;">or you can set the compression
1178 level used by gzip or xz compression:</p>
1180 <p style="margin-left:14%;"><b>tar −czf</b>
1182 <b>−−options=’compression-level=9’</b>.</p>
1184 <p style="margin-left:6%;">For more details, see the
1185 explanation of the <b>archive_read_set_options</b>() and
1186 <b>archive_write_set_options</b>() API calls that are
1187 described in archive_read(3) and archive_write(3).</p>
1189 <p style="margin-top: 1em"><b>COMPATIBILITY</b></p>
1191 <p style="margin-left:6%;">The bundled-arguments format is
1192 supported for compatibility with historic implementations.
1193 It consists of an initial word (with no leading - character)
1194 in which each character indicates an option. Arguments
1195 follow as separate words. The order of the arguments must
1196 match the order of the corresponding characters in the
1197 bundled command word. For example,</p>
1199 <p style="margin-left:14%;"><b>tar tbf 32</b>
1202 <p style="margin-left:6%;">specifies three flags <b>t</b>,
1203 <b>b</b>, and <b>f</b>. The <b>b</b> and <b>f</b> flags both
1204 require arguments, so there must be two additional items on
1205 the command line. The <i>32</i> is the argument to the
1206 <b>b</b> flag, and <i>file.tar</i> is the argument to the
1209 <p style="margin-left:6%; margin-top: 1em">The mode options
1210 c, r, t, u, and x and the options b, f, l, m, o, v, and w
1211 comply with SUSv2.</p>
1213 <p style="margin-left:6%; margin-top: 1em">For maximum
1214 portability, scripts that invoke <b>tar</b> should use the
1215 bundled-argument format above, should limit themselves to
1216 the <b>c</b>, <b>t</b>, and <b>x</b> modes, and the
1217 <b>b</b>, <b>f</b>, <b>m</b>, <b>v</b>, and <b>w</b>
1220 <p style="margin-left:6%; margin-top: 1em">Additional long
1221 options are provided to improve compatibility with other tar
1222 implementations.</p>
1224 <p style="margin-top: 1em"><b>SECURITY</b></p>
1226 <p style="margin-left:6%;">Certain security issues are
1227 common to many archiving programs, including <b>tar</b>. In
1228 particular, carefully-crafted archives can request that
1229 <b>tar</b> extract files to locations outside of the target
1230 directory. This can potentially be used to cause unwitting
1231 users to overwrite files they did not intend to overwrite.
1232 If the archive is being extracted by the superuser, any file
1233 on the system can potentially be overwritten. There are
1234 three ways this can happen. Although <b>tar</b> has
1235 mechanisms to protect against each one, savvy users should
1236 be aware of the implications:</p>
1238 <p style="margin-top: 1em"><b>•</b></p>
1240 <p style="margin-left:17%;">Archive entries can have
1241 absolute pathnames. By default, <b>tar</b> removes the
1242 leading <i>/</i> character from filenames before restoring
1243 them to guard against this problem.</p>
1245 <p style="margin-top: 1em"><b>•</b></p>
1247 <p style="margin-left:17%;">Archive entries can have
1248 pathnames that include <i>..</i> components. By default,
1249 <b>tar</b> will not extract files containing <i>..</i>
1250 components in their pathname.</p>
1252 <p style="margin-top: 1em"><b>•</b></p>
1254 <p style="margin-left:17%;">Archive entries can exploit
1255 symbolic links to restore files to other directories. An
1256 archive can restore a symbolic link to another directory,
1257 then use that link to restore a file into that directory. To
1258 guard against this, <b>tar</b> checks each extracted path
1259 for symlinks. If the final path element is a symlink, it
1260 will be removed and replaced with the archive entry. If
1261 <b>−U</b> is specified, any intermediate symlink will
1262 also be unconditionally removed. If neither <b>−U</b>
1263 nor <b>−P</b> is specified, <b>tar</b> will refuse to
1264 extract the entry.</p>
1266 <p style="margin-left:6%;">To protect yourself, you should
1267 be wary of any archives that come from untrusted sources.
1268 You should examine the contents of an archive with</p>
1270 <p style="margin-left:14%;"><b>tar −tf</b>
1273 <p style="margin-left:6%;">before extraction. You should
1274 use the <b>−k</b> option to ensure that <b>tar</b>
1275 will not overwrite any existing files or the <b>−U</b>
1276 option to remove any pre-existing files. You should
1277 generally not extract archives while running with super-user
1278 privileges. Note that the <b>−P</b> option to
1279 <b>tar</b> disables the security checks above and allows you
1280 to extract an archive while preserving any absolute
1281 pathnames, <i>..</i> components, or symlinks to other
1284 <p style="margin-top: 1em"><b>SEE ALSO</b></p>
1286 <p style="margin-left:6%;">bzip2(1), compress(1), cpio(1),
1287 gzip(1), mt(1), pax(1), shar(1), xz(1), libarchive(3),
1288 libarchive-formats(5), tar(5)</p>
1290 <p style="margin-top: 1em"><b>STANDARDS</b></p>
1292 <p style="margin-left:6%;">There is no current POSIX
1293 standard for the tar command; it appeared in ISO/IEC
1294 9945-1:1996 (‘‘POSIX.1’’) but was
1295 dropped from IEEE Std 1003.1-2001
1296 (‘‘POSIX.1’’). The options supported
1297 by this implementation were developed by surveying a number
1298 of existing tar implementations as well as the old POSIX
1299 specification for tar and the current POSIX specification
1302 <p style="margin-left:6%; margin-top: 1em">The ustar and
1303 pax interchange file formats are defined by IEEE Std
1304 1003.1-2001 (‘‘POSIX.1’’) for the
1307 <p style="margin-top: 1em"><b>HISTORY</b></p>
1309 <p style="margin-left:6%;">A <b>tar</b> command appeared in
1310 Seventh Edition Unix, which was released in January, 1979.
1311 There have been numerous other implementations, many of
1312 which extended the file format. John Gilmore’s
1313 <b>pdtar</b> public-domain implementation (circa November,
1314 1987) was quite influential, and formed the basis of GNU
1315 tar. GNU tar was included as the standard system tar in
1316 FreeBSD beginning with FreeBSD 1.0.</p>
1318 <p style="margin-left:6%; margin-top: 1em">This is a
1319 complete re-implementation based on the libarchive(3)
1320 library. It was first released with FreeBSD 5.4 in May,
1323 <p style="margin-top: 1em"><b>BUGS</b></p>
1325 <p style="margin-left:6%;">This program follows ISO/IEC
1326 9945-1:1996 (‘‘POSIX.1’’) for the
1327 definition of the <b>−l</b> option. Note that GNU tar
1328 prior to version 1.15 treated <b>−l</b> as a synonym
1329 for the <b>−−one-file-system</b> option.</p>
1331 <p style="margin-left:6%; margin-top: 1em">The
1332 <b>−C</b> <i>dir</i> option may differ from historic
1333 implementations.</p>
1335 <p style="margin-left:6%; margin-top: 1em">All archive
1336 output is written in correctly-sized blocks, even if the
1337 output is being compressed. Whether or not the last output
1338 block is padded to a full block size varies depending on the
1339 format and the output device. For tar and cpio formats, the
1340 last block of output is padded to a full block size if the
1341 output is being written to standard output or to a character
1342 or block device such as a tape drive. If the output is being
1343 written to a regular file, the last block will not be
1344 padded. Many compressors, including gzip(1) and bzip2(1),
1345 complain about the null padding when decompressing an
1346 archive created by <b>tar</b>, although they still extract
1349 <p style="margin-left:6%; margin-top: 1em">The compression
1350 and decompression is implemented internally, so there may be
1351 insignificant differences between the compressed output
1354 <p style="margin-left:14%;"><b>tar −czf</b> <i>-
1357 <p style="margin-left:6%;">and that generated by</p>
1359 <p style="margin-left:14%;"><b>tar −cf</b> <i>-
1360 file</i> | <b>gzip</b></p>
1362 <p style="margin-left:6%; margin-top: 1em">The default
1363 should be to read and write archives to the standard I/O
1364 paths, but tradition (and POSIX) dictates otherwise.</p>
1366 <p style="margin-left:6%; margin-top: 1em">The <b>r</b> and
1367 <b>u</b> modes require that the archive be uncompressed and
1368 located in a regular file on disk. Other archives can be
1369 modified using <b>c</b> mode with the <i>@archive-file</i>
1372 <p style="margin-left:6%; margin-top: 1em">To archive a
1373 file called <i>@foo</i> or <i>-foo</i> you must specify it
1374 as <i>./@foo</i> or <i>./-foo</i>, respectively.</p>
1376 <p style="margin-left:6%; margin-top: 1em">In create mode,
1377 a leading <i>./</i> is always removed. A leading <i>/</i> is
1378 stripped unless the <b>−P</b> option is specified.</p>
1380 <p style="margin-left:6%; margin-top: 1em">There needs to
1381 be better support for file selection on both create and
1384 <p style="margin-left:6%; margin-top: 1em">There is not yet
1385 any support for multi-volume archives.</p>
1387 <p style="margin-left:6%; margin-top: 1em">Converting
1388 between dissimilar archive formats (such as tar and cpio)
1389 using the <b>@</b><i>-</i> convention can cause hard link
1390 information to be lost. (This is a consequence of the
1391 incompatible ways that different archive formats store
1392 hardlink information.)</p>
1394 <p style="margin-left:6%; margin-top: 1em">BSD
1395 February 24, 2017 BSD</p>