1TAR(1)                    BSD General Commands Manual                   TAR(1)
2

NAME

4     tar — manipulate tape archives
5

SYNOPSIS

7     tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...]
8     tar {-c} [options] [files | directories]
9     tar {-r | -u} -f archive-file [options] [files | directories]
10     tar {-t | -x} [options] [patterns]
11

DESCRIPTION

13     tar creates and manipulates streaming archive files.  This implementation
14     can extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip, and ISO
15     9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar
16     archives.
17
18     The first synopsis form shows a “bundled” option word.  This usage is
19     provided for compatibility with historical implementations.  See COMPATI‐
20     BILITY below for details.
21
22     The other synopsis forms show the preferred usage.  The first option to
23     tar is a mode indicator from the following list:
24     -c      Create a new archive containing the specified items.  The long
25             option form is --create.
26     -r      Like -c, but new entries are appended to the archive.  Note that
27             this only works on uncompressed archives stored in regular files.
28             The -f option is required.  The long option form is --append.
29     -t      List archive contents to stdout.  The long option form is --list.
30     -u      Like -r, but new entries are added only if they have a modifica‐
31             tion date newer than the corresponding entry in the archive.
32             Note that this only works on uncompressed archives stored in reg‐
33             ular files.  The -f option is required.  The long form is
34             --update.
35     -x      Extract to disk from the archive.  If a file with the same name
36             appears more than once in the archive, each copy will be
37             extracted, with later copies overwriting (replacing) earlier
38             copies.  The long option form is --extract.
39
40     In -c, -r, or -u mode, each specified file or directory is added to the
41     archive in the order specified on the command line.  By default, the con‐
42     tents of each directory are also archived.
43
44     In extract or list mode, the entire command line is read and parsed
45     before the archive is opened.  The pathnames or patterns on the command
46     line indicate which items in the archive should be processed.  Patterns
47     are shell-style globbing patterns as documented in tcsh(1).
48

OPTIONS

50     Unless specifically stated otherwise, options are applicable in all oper‐
51     ating modes.
52
53     @archive
54             (c and r mode only) The specified archive is opened and the
55             entries in it will be appended to the current archive.  As a sim‐
56             ple example,
57                   tar -c -f - newfile @original.tar
58             writes a new archive to standard output containing a file newfile
59             and all of the entries from original.tar.  In contrast,
60                   tar -c -f - newfile original.tar
61             creates a new archive with only two entries.  Similarly,
62                   tar -czf - --format pax @-
63             reads an archive from standard input (whose format will be deter‐
64             mined automatically) and converts it into a gzip-compressed pax-
65             format archive on stdout.  In this way, tar can be used to con‐
66             vert archives from one format to another.
67
68     -a, --auto-compress
69             (c mode only) Use the archive suffix to decide a set of the for‐
70             mat and the compressions.  As a simple example,
71                   tar -a -cf archive.tgz source.c source.h
72             creates a new archive with restricted pax format and gzip com‐
73             pression,
74                   tar -a -cf archive.tar.bz2.uu source.c source.h
75             creates a new archive with restricted pax format and bzip2 com‐
76             pression and uuencode compression,
77                   tar -a -cf archive.zip source.c source.h
78             creates a new archive with zip format,
79                   tar -a -jcf archive.tgz source.c source.h
80             ignores the “-j” option, and creates a new archive with
81             restricted pax format and gzip compression,
82                   tar -a -jcf archive.xxx source.c source.h
83             if it is unknown suffix or no suffix, creates a new archive with
84             restricted pax format and bzip2 compression.
85
86     -B, --read-full-blocks
87             Ignored for compatibility with other tar(1) implementations.
88
89     -b blocksize, --block-size blocksize
90             Specify the block size, in 512-byte records, for tape drive I/O.
91             As a rule, this argument is only needed when reading from or
92             writing to tape drives, and usually not even then as the default
93             block size of 20 records (10240 bytes) is very common.
94
95     -C directory, --cd directory, --directory directory
96             In c and r mode, this changes the directory before adding the
97             following files.  In x mode, change directories after opening the
98             archive but before extracting entries from the archive.
99
100     --chroot
101             (x mode only) chroot() to the current directory after processing
102             any -C options and before extracting any files.
103
104     --disable-copyfile
105             Mac OS X specific.  Disable the use of copyfile(3).
106
107     --exclude pattern
108             Do not process files or directories that match the specified pat‐
109             tern.  Note that exclusions take precedence over patterns or
110             filenames specified on the command line.
111
112     --format format
113             (c, r, u mode only) Use the specified format for the created ar‐
114             chive.  Supported formats include “cpio”, “pax”, “shar”, and
115             “ustar”.  Other formats may also be supported; see
116             libarchive-formats(5) for more information about currently-sup‐
117             ported formats.  In r and u modes, when extending an existing ar‐
118             chive, the format specified here must be compatible with the for‐
119             mat of the existing archive on disk.
120
121     -f file, --file file
122             Read the archive from or write the archive to the specified file.
123             The filename can be - for standard input or standard output.  The
124             default varies by system; on FreeBSD, the default is /dev/sa0; on
125             Linux, the default is /dev/st0.
126
127     --gid id
128             Use the provided group id number.  On extract, this overrides the
129             group id in the archive; the group name in the archive will be
130             ignored.  On create, this overrides the group id read from disk;
131             if --gname is not also specified, the group name will be set to
132             match the group id.
133
134     --gname name
135             Use the provided group name.  On extract, this overrides the
136             group name in the archive; if the provided group name does not
137             exist on the system, the group id (from the archive or from the
138             --gid option) will be used instead.  On create, this sets the
139             group name that will be stored in the archive; the name will not
140             be verified against the system group database.
141
142     -H      (c and r mode only) Symbolic links named on the command line will
143             be followed; the target of the link will be archived, not the
144             link itself.
145
146     -h      (c and r mode only) Synonym for -L.
147
148     -I      Synonym for -T.
149
150     --help  Show usage.
151
152     --hfsCompression
153             (x mode only) Mac OS X specific(v10.6 or later). Compress
154             extracted regular files with HFS+ compression.
155
156     --include pattern
157             Process only files or directories that match the specified pat‐
158             tern.  Note that exclusions specified with --exclude take prece‐
159             dence over inclusions.  If no inclusions are explicitly speci‐
160             fied, all entries are processed by default.  The --include option
161             is especially useful when filtering archives.  For example, the
162             command
163                   tar -c -f new.tar --include='*foo*' @old.tgz
164             creates a new archive new.tar containing only the entries from
165             old.tgz containing the string ‘foo’.
166
167     -J, --xz
168             (c mode only) Compress the resulting archive with xz(1).  In
169             extract or list modes, this option is ignored.  Note that, unlike
170             other tar implementations, this implementation recognizes XZ com‐
171             pression automatically when reading archives.
172
173     -j, --bzip, --bzip2, --bunzip2
174             (c mode only) Compress the resulting archive with bzip2(1).  In
175             extract or list modes, this option is ignored.  Note that, unlike
176             other tar implementations, this implementation recognizes bzip2
177             compression automatically when reading archives.
178
179     -k, --keep-old-files
180             (x mode only) Do not overwrite existing files.  In particular, if
181             a file appears more than once in an archive, later copies will
182             not overwrite earlier copies.
183
184     --keep-newer-files
185             (x mode only) Do not overwrite existing files that are newer than
186             the versions appearing in the archive being extracted.
187
188     -L, --dereference
189             (c and r mode only) All symbolic links will be followed.  Nor‐
190             mally, symbolic links are archived as such.  With this option,
191             the target of the link will be archived instead.
192
193     -l, --check-links
194             (c and r modes only) Issue a warning message unless all links to
195             each file are archived.
196
197     --lrzip
198             (c mode only) Compress the resulting archive with lrzip(1).  In
199             extract or list modes, this option is ignored.
200
201     --lzma  (c mode only) Compress the resulting archive with the original
202             LZMA algorithm.  Use of this option is discouraged and new ar‐
203             chives should be created with --xz instead.  Note that, unlike
204             other tar implementations, this implementation recognizes LZMA
205             compression automatically when reading archives.
206
207     --lzop  (c mode only) Compress the resulting archive with lzop(1).  In
208             extract or list modes, this option is ignored.
209
210     -m, --modification-time
211             (x mode only) Do not extract modification time.  By default, the
212             modification time is set to the time stored in the archive.
213
214     -n, --norecurse, --no-recursion
215             (c, r, u modes only) Do not recursively archive the contents of
216             directories.
217
218     --newer date
219             (c, r, u modes only) Only include files and directories newer
220             than the specified date.  This compares ctime entries.
221
222     --newer-mtime date
223             (c, r, u modes only) Like --newer, except it compares mtime
224             entries instead of ctime entries.
225
226     --newer-than file
227             (c, r, u modes only) Only include files and directories newer
228             than the specified file.  This compares ctime entries.
229
230     --newer-mtime-than file
231             (c, r, u modes only) Like --newer-than, except it compares mtime
232             entries instead of ctime entries.
233
234     --nodump
235             (c and r modes only) Honor the nodump file flag by skipping this
236             file.
237
238     --nopreserveHFSCompression
239             (x mode only) Mac OS X specific(v10.6 or later). Do not compress
240             extracted regular files which were compressed with HFS+ compres‐
241             sion before archived.  By default, compress the regular files
242             again with HFS+ compression.
243
244     --null  (use with -I or -T) Filenames or patterns are separated by null
245             characters, not by newlines.  This is often used to read file‐
246             names output by the -print0 option to find(1).
247
248     --no-same-owner
249             (x mode only) Do not extract owner and group IDs.  This is the
250             reverse of --same-owner and the default behavior if tar is run as
251             non-root.
252
253     --no-same-permissions
254             (x mode only) Do not extract full permissions (SGID, SUID, sticky
255             bit, ACLs, extended attributes or extended file flags).  This is
256             the reverse of -p and the default behavior if tar is run as non-
257             root.
258
259     --numeric-owner
260             This is equivalent to --uname "" --gname "".  On extract, it
261             causes user and group names in the archive to be ignored in favor
262             of the numeric user and group ids.  On create, it causes user and
263             group names to not be stored in the archive.
264
265     -O, --to-stdout
266             (x, t modes only) In extract (-x) mode, files will be written to
267             standard out rather than being extracted to disk.  In list (-t)
268             mode, the file listing will be written to stderr rather than the
269             usual stdout.
270
271     -o      (x mode) Use the user and group of the user running the program
272             rather than those specified in the archive.  Note that this has
273             no significance unless -p is specified, and the program is being
274             run by the root user.  In this case, the file modes and flags
275             from the archive will be restored, but ACLs or owner information
276             in the archive will be discarded.
277
278     -o      (c, r, u mode) A synonym for --format ustar
279
280     --older date
281             (c, r, u modes only) Only include files and directories older
282             than the specified date.  This compares ctime entries.
283
284     --older-mtime date
285             (c, r, u modes only) Like --older, except it compares mtime
286             entries instead of ctime entries.
287
288     --older-than file
289             (c, r, u modes only) Only include files and directories older
290             than the specified file.  This compares ctime entries.
291
292     --older-mtime-than file
293             (c, r, u modes only) Like --older-than, except it compares mtime
294             entries instead of ctime entries.
295
296     --one-file-system
297             (c, r, and u modes) Do not cross mount points.
298
299     --options options
300             Select optional behaviors for particular modules.  The argument
301             is a text string containing comma-separated keywords and values.
302             These are passed to the modules that handle particular formats to
303             control how those formats will behave.  Each option has one of
304             the following forms:
305             key=value
306                     The key will be set to the specified value in every mod‐
307                     ule that supports it.  Modules that do not support this
308                     key will ignore it.
309             key     The key will be enabled in every module that supports it.
310                     This is equivalent to key=1.
311             !key    The key will be disabled in every module that supports
312                     it.
313             module:key=value, module:key, module:!key
314                     As above, but the corresponding key and value will be
315                     provided only to modules whose name matches module.
316             The currently supported modules and keys are:
317             iso9660:joliet
318                     Support Joliet extensions.  This is enabled by default,
319                     use !joliet or iso9660:!joliet to disable.
320             iso9660:rockridge
321                     Support Rock Ridge extensions.  This is enabled by
322                     default, use !rockridge or iso9660:!rockridge to disable.
323             gzip:compression-level
324                     A decimal integer from 1 to 9 specifying the gzip com‐
325                     pression level.
326             gzip:timestamp
327                     Store timestamp. This is enabled by default, use
328                     !timestamp or gzip:!timestamp to disable.
329             lrzip:compression=type
330                     Use type as compression method.  Supported values are
331                     bzip2, gzip, lzo (ultra fast), and zpaq (best, extremely
332                     slow).
333             lrzip:compression-level
334                     A decimal integer from 1 to 9 specifying the lrzip com‐
335                     pression level.
336             lzop:compression-level
337                     A decimal integer from 1 to 9 specifying the lzop com‐
338                     pression level.
339             xz:compression-level
340                     A decimal integer from 0 to 9 specifying the xz compres‐
341                     sion level.
342             mtree:keyword
343                     The mtree writer module allows you to specify which mtree
344                     keywords will be included in the output.  Supported key‐
345                     words include: cksum, device, flags, gid, gname, indent,
346                     link, md5, mode, nlink, rmd160, sha1, sha256, sha384,
347                     sha512, size, time, uid, uname.  The default is equiva‐
348                     lent to: “device, flags, gid, gname, link, mode, nlink,
349                     size, time, type, uid, uname”.
350             mtree:all
351                     Enables all of the above keywords.  You can also use
352                     mtree:!all to disable all keywords.
353             mtree:use-set
354                     Enable generation of /set lines in the output.
355             mtree:indent
356                     Produce human-readable output by indenting options and
357                     splitting lines to fit into 80 columns.
358             zip:compression=type
359                     Use type as compression method.  Supported values are
360                     store (uncompressed) and deflate (gzip algorithm).
361             If a provided option is not supported by any module, that is a
362             fatal error.
363
364     -P, --absolute-paths
365             Preserve pathnames.  By default, absolute pathnames (those that
366             begin with a / character) have the leading slash removed both
367             when creating archives and extracting from them.  Also, tar will
368             refuse to extract archive entries whose pathnames contain .. or
369             whose target directory would be altered by a symlink.  This
370             option suppresses these behaviors.
371
372     -p, --insecure, --preserve-permissions
373             (x mode only) Preserve file permissions.  Attempt to restore the
374             full permissions, including owner, file modes, file flags and
375             ACLs, if available, for each item extracted from the archive.
376             This is the default, if tar is being run by root and can be over‐
377             ridden by also specifying --no-same-owner and
378             --no-same-permissions.
379
380     --posix
381             (c, r, u mode only) Synonym for --format pax
382
383     -q, --fast-read
384             (x and t mode only) Extract or list only the first archive entry
385             that matches each pattern or filename operand.  Exit as soon as
386             each specified pattern or filename has been matched.  By default,
387             the archive is always read to the very end, since there can be
388             multiple entries with the same name and, by convention, later
389             entries overwrite earlier entries.  This option is provided as a
390             performance optimization.
391
392     -S      (x mode only) Extract files as sparse files.  For every block on
393             disk, check first if it contains only NULL bytes and seek over it
394             otherwise.  This works similar to the conv=sparse option of dd.
395
396     -s pattern
397             Modify file or archive member names according to pattern.  The
398             pattern has the format /old/new/[ghHprRsS] where old is a basic
399             regular expression, new is the replacement string of the matched
400             part, and the optional trailing letters modify how the replace‐
401             ment is handled.  If old is not matched, the pattern is skipped.
402             Within new, ~ is substituted with the match, \1 to \9 with the
403             content of the corresponding captured group.  The optional trail‐
404             ing g specifies that matching should continue after the matched
405             part and stop on the first unmatched pattern.  The optional
406             trailing s specifies that the pattern applies to the value of
407             symbolic links.  The optional trailing p specifies that after a
408             successful substitution the original path name and the new path
409             name should be printed to standard error.  Optional trailing H,
410             R, or S characters suppress substitutions for hardlink targets,
411             regular filenames, or symlink targets, respectively.  Optional
412             trailing h, r, or s characters enable substitutions for hardlink
413             targets, regular filenames, or symlink targets, respectively.
414             The default is hrs which applies substitutions to all names.  In
415             particular, it is never necessary to specify h, r, or s.
416
417     --same-owner
418             (x mode only) Extract owner and group IDs.  This is the reverse
419             of --no-same-owner and the default behavior if tar is run as
420             root.
421
422     --strip-components count
423             Remove the specified number of leading path elements.  Pathnames
424             with fewer elements will be silently skipped.  Note that the
425             pathname is edited after checking inclusion/exclusion patterns
426             but before security checks.
427
428     -T filename, --files-from filename
429             In x or t mode, tar will read the list of names to be extracted
430             from filename.  In c mode, tar will read names to be archived
431             from filename.  The special name “-C” on a line by itself will
432             cause the current directory to be changed to the directory speci‐
433             fied on the following line.  Names are terminated by newlines
434             unless --null is specified.  Note that --null also disables the
435             special handling of lines containing “-C”.  Note:  If you are
436             generating lists of files using find(1), you probably want to use
437             -n as well.
438
439     --totals
440             (c, r, u mode only) After archiving all files, print a summary to
441             stderr.
442
443     -U, --unlink, --unlink-first
444             (x mode only) Unlink files before creating them.  This can be a
445             minor performance optimization if most files already exist, but
446             can make things slower if most files do not already exist.  This
447             flag also causes tar to remove intervening directory symlinks
448             instead of reporting an error.  See the SECURITY section below
449             for more details.
450
451     --uid id
452             Use the provided user id number and ignore the user name from the
453             archive.  On create, if --uname is not also specified, the user
454             name will be set to match the user id.
455
456     --uname name
457             Use the provided user name.  On extract, this overrides the user
458             name in the archive; if the provided user name does not exist on
459             the system, it will be ignored and the user id (from the archive
460             or from the --uid option) will be used instead.  On create, this
461             sets the user name that will be stored in the archive; the name
462             is not verified against the system user database.
463
464     --use-compress-program program
465             Pipe the input (in x or t mode) or the output (in c mode) through
466             program instead of using the builtin compression support.
467
468     -v, --verbose
469             Produce verbose output.  In create and extract modes, tar will
470             list each file name as it is read from or written to the archive.
471             In list mode, tar will produce output similar to that of ls(1).
472             Additional -v options will provide additional detail.
473
474     --version
475             Print version of tar and libarchive, and exit.
476
477     -w, --confirmation, --interactive
478             Ask for confirmation for every action.
479
480     -X filename, --exclude-from filename
481             Read a list of exclusion patterns from the specified file.  See
482             --exclude for more information about the handling of exclusions.
483
484     -y      (c mode only) Compress the resulting archive with bzip2(1).  In
485             extract or list modes, this option is ignored.  Note that, unlike
486             other tar implementations, this implementation recognizes bzip2
487             compression automatically when reading archives.
488
489     -Z, --compress, --uncompress
490             (c mode only) Compress the resulting archive with compress(1).
491             In extract or list modes, this option is ignored.  Note that,
492             unlike other tar implementations, this implementation recognizes
493             compress compression automatically when reading archives.
494
495     -z, --gunzip, --gzip
496             (c mode only) Compress the resulting archive with gzip(1).  In
497             extract or list modes, this option is ignored.  Note that, unlike
498             other tar implementations, this implementation recognizes gzip
499             compression automatically when reading archives.
500

ENVIRONMENT

502     The following environment variables affect the execution of tar:
503
504     TAR_READER_OPTIONS
505                The default options for format readers and compression read‐
506                ers.  The --options option overrides this.
507
508     TAR_WRITER_OPTIONS
509                The default options for format writers and compression writ‐
510                ers.  The --options option overrides this.
511
512     LANG       The locale to use.  See environ(7) for more information.
513
514     TAPE       The default device.  The -f option overrides this.  Please see
515                the description of the -f option above for more details.
516
517     TZ         The timezone to use when displaying dates.  See environ(7) for
518                more information.
519

EXIT STATUS

521     The tar utility exits 0 on success, and >0 if an error occurs.
522

EXAMPLES

524     The following creates a new archive called file.tar.gz that contains two
525     files source.c and source.h:
526           tar -czf file.tar.gz source.c source.h
527
528     To view a detailed table of contents for this archive:
529           tar -tvf file.tar.gz
530
531     To extract all entries from the archive on the default tape drive:
532           tar -x
533
534     To examine the contents of an ISO 9660 cdrom image:
535           tar -tf image.iso
536
537     To move file hierarchies, invoke tar as
538           tar -cf - -C srcdir . | tar -xpf - -C destdir
539     or more traditionally
540           cd srcdir ; tar -cf - . | (cd destdir ; tar -xpf -)
541
542     In create mode, the list of files and directories to be archived can also
543     include directory change instructions of the form -Cfoo/baz and archive
544     inclusions of the form @archive-file.  For example, the command line
545           tar -c -f new.tar foo1 @old.tgz -C/tmp foo2
546     will create a new archive new.tar.  tar will read the file foo1 from the
547     current directory and add it to the output archive.  It will then read
548     each entry from old.tgz and add those entries to the output archive.
549     Finally, it will switch to the /tmp directory and add foo2 to the output
550     archive.
551
552     An input file in mtree(5) format can be used to create an output archive
553     with arbitrary ownership, permissions, or names that differ from existing
554     data on disk:
555
556           $ cat input.mtree
557           #mtree
558           usr/bin uid=0 gid=0 mode=0755 type=dir
559           usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
560           $ tar -cvf output.tar @input.mtree
561
562     The --newer and --newer-mtime switches accept a variety of common date
563     and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12
564     19:14”, “5 minutes ago”, and “19:14 PST May 1”.
565
566     The --options argument can be used to control various details of archive
567     generation or reading.  For example, you can generate mtree output which
568     only contains type, time, and uid keywords:
569           tar -cf file.tar --format=mtree --options='!all,type,time,uid' dir
570     or you can set the compression level used by gzip or xz compression:
571           tar -czf file.tar --options='compression-level=9'.
572     For more details, see the explanation of the archive_read_set_options()
573     and archive_write_set_options() API calls that are described in
574     archive_read(3) and archive_write(3).
575

COMPATIBILITY

577     The bundled-arguments format is supported for compatibility with historic
578     implementations.  It consists of an initial word (with no leading - char‐
579     acter) in which each character indicates an option.  Arguments follow as
580     separate words.  The order of the arguments must match the order of the
581     corresponding characters in the bundled command word.  For example,
582           tar tbf 32 file.tar
583     specifies three flags t, b, and f.  The b and f flags both require argu‐
584     ments, so there must be two additional items on the command line.  The 32
585     is the argument to the b flag, and file.tar is the argument to the f
586     flag.
587
588     The mode options c, r, t, u, and x and the options b, f, l, m, o, v, and
589     w comply with SUSv2.
590
591     For maximum portability, scripts that invoke tar should use the bundled-
592     argument format above, should limit themselves to the c, t, and x modes,
593     and the b, f, m, v, and w options.
594
595     Additional long options are provided to improve compatibility with other
596     tar implementations.
597

SECURITY

599     Certain security issues are common to many archiving programs, including
600     tar.  In particular, carefully-crafted archives can request that tar
601     extract files to locations outside of the target directory.  This can
602     potentially be used to cause unwitting users to overwrite files they did
603     not intend to overwrite.  If the archive is being extracted by the supe‐
604     ruser, any file on the system can potentially be overwritten.  There are
605     three ways this can happen.  Although tar has mechanisms to protect
606     against each one, savvy users should be aware of the implications:
607
608     ·       Archive entries can have absolute pathnames.  By default, tar
609             removes the leading / character from filenames before restoring
610             them to guard against this problem.
611
612     ·       Archive entries can have pathnames that include .. components.
613             By default, tar will not extract files containing .. components
614             in their pathname.
615
616     ·       Archive entries can exploit symbolic links to restore files to
617             other directories.  An archive can restore a symbolic link to
618             another directory, then use that link to restore a file into that
619             directory.  To guard against this, tar checks each extracted path
620             for symlinks.  If the final path element is a symlink, it will be
621             removed and replaced with the archive entry.  If -U is specified,
622             any intermediate symlink will also be unconditionally removed.
623             If neither -U nor -P is specified, tar will refuse to extract the
624             entry.
625     To protect yourself, you should be wary of any archives that come from
626     untrusted sources.  You should examine the contents of an archive with
627           tar -tf filename
628     before extraction.  You should use the -k option to ensure that tar will
629     not overwrite any existing files or the -U option to remove any pre-
630     existing files.  You should generally not extract archives while running
631     with super-user privileges.  Note that the -P option to tar disables the
632     security checks above and allows you to extract an archive while preserv‐
633     ing any absolute pathnames, .. components, or symlinks to other directo‐
634     ries.
635

SEE ALSO

637     bzip2(1), compress(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), xz(1),
638     libarchive(3), libarchive-formats(5), tar(5)
639

STANDARDS

641     There is no current POSIX standard for the tar command; it appeared in
642     ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001
643     (“POSIX.1”).  The options supported by this implementation were developed
644     by surveying a number of existing tar implementations as well as the old
645     POSIX specification for tar and the current POSIX specification for pax.
646
647     The ustar and pax interchange file formats are defined by IEEE Std
648     1003.1-2001 (“POSIX.1”) for the pax command.
649

HISTORY

651     A tar command appeared in Seventh Edition Unix, which was released in
652     January, 1979.  There have been numerous other implementations, many of
653     which extended the file format.  John Gilmore's pdtar public-domain
654     implementation (circa November, 1987) was quite influential, and formed
655     the basis of GNU tar.  GNU tar was included as the standard system tar in
656     FreeBSD beginning with FreeBSD 1.0.
657
658     This is a complete re-implementation based on the libarchive(3) library.
659     It was first released with FreeBSD 5.4 in May, 2005.
660

BUGS

662     This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition
663     of the -l option.  Note that GNU tar prior to version 1.15 treated -l as
664     a synonym for the --one-file-system option.
665
666     The -C dir option may differ from historic implementations.
667
668     All archive output is written in correctly-sized blocks, even if the out‐
669     put is being compressed.  Whether or not the last output block is padded
670     to a full block size varies depending on the format and the output
671     device.  For tar and cpio formats, the last block of output is padded to
672     a full block size if the output is being written to standard output or to
673     a character or block device such as a tape drive.  If the output is being
674     written to a regular file, the last block will not be padded.  Many com‐
675     pressors, including gzip(1) and bzip2(1), complain about the null padding
676     when decompressing an archive created by tar, although they still extract
677     it correctly.
678
679     The compression and decompression is implemented internally, so there may
680     be insignificant differences between the compressed output generated by
681           tar -czf - file
682     and that generated by
683           tar -cf - file | gzip
684
685     The default should be to read and write archives to the standard I/O
686     paths, but tradition (and POSIX) dictates otherwise.
687
688     The r and u modes require that the archive be uncompressed and located in
689     a regular file on disk.  Other archives can be modified using c mode with
690     the @archive-file extension.
691
692     To archive a file called @foo or -foo you must specify it as ./@foo or
693     ./-foo, respectively.
694
695     In create mode, a leading ./ is always removed.  A leading / is stripped
696     unless the -P option is specified.
697
698     There needs to be better support for file selection on both create and
699     extract.
700
701     There is not yet any support for multi-volume archives or for archiving
702     sparse files.
703
704     Converting between dissimilar archive formats (such as tar and cpio)
705     using the @- convention can cause hard link information to be lost.
706     (This is a consequence of the incompatible ways that different archive
707     formats store hardlink information.)
708
709BSD                            November 1, 2012                            BSD
Impressum