1 .\" Copyright (c) 2003-2007 Tim Kientzle
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .Dd September 16, 2014
32 .Nd manipulate tape archives
35 .Op Ar bundled-flags Ao args Ac
36 .Op Ao Ar file Ac | Ao Ar pattern Ac ...
40 .Op Ar files | Ar directories
45 .Op Ar files | Ar directories
52 creates and manipulates streaming archive files.
53 This implementation can extract from tar, pax, cpio, zip, jar, ar, xar,
54 rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip,
55 7-zip, and shar archives.
57 The first synopsis form shows a
60 This usage is provided for compatibility with historical implementations.
61 See COMPATIBILITY below for details.
63 The other synopsis forms show the preferred usage.
66 is a mode indicator from the following list:
67 .Bl -tag -compact -width indent
69 Create a new archive containing the specified items.
70 The long option form is
75 but new entries are appended to the archive.
76 Note that this only works on uncompressed archives stored in regular files.
80 The long option form is
83 List archive contents to stdout.
84 The long option form is
89 but new entries are added only if they have a modification date
90 newer than the corresponding entry in the archive.
91 Note that this only works on uncompressed archives stored in regular files.
98 Extract to disk from the archive.
99 If a file with the same name appears more than once in the archive,
100 each copy will be extracted, with later copies overwriting (replacing)
102 The long option form is
111 mode, each specified file or directory is added to the
112 archive in the order specified on the command line.
113 By default, the contents of each directory are also archived.
115 In extract or list mode, the entire command line
116 is read and parsed before the archive is opened.
117 The pathnames or patterns on the command line indicate
118 which items in the archive should be processed.
119 Patterns are shell-style globbing patterns as
123 Unless specifically stated otherwise, options are applicable in
125 .Bl -tag -width indent
126 .It Cm @ Ns Pa archive
128 The specified archive is opened and the entries
129 in it will be appended to the current archive.
131 .Dl Nm Fl c Fl f Pa - Pa newfile Cm @ Ns Pa original.tar
132 writes a new archive to standard output containing a file
134 and all of the entries from
137 .Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
138 creates a new archive with only two entries.
140 .Dl Nm Fl czf Pa - Fl Fl format Cm pax Cm @ Ns Pa -
141 reads an archive from standard input (whose format will be determined
142 automatically) and converts it into a gzip-compressed
143 pax-format archive on stdout.
146 can be used to convert archives from one format to another.
147 .It Fl a , Fl Fl auto-compress
149 Use the archive suffix to decide a set of the format and
152 .Dl Nm Fl a Fl cf Pa archive.tgz source.c source.h
153 creates a new archive with restricted pax format and gzip compression,
154 .Dl Nm Fl a Fl cf Pa archive.tar.bz2.uu source.c source.h
155 creates a new archive with restricted pax format and bzip2 compression
156 and uuencode compression,
157 .Dl Nm Fl a Fl cf Pa archive.zip source.c source.h
158 creates a new archive with zip format,
159 .Dl Nm Fl a Fl jcf Pa archive.tgz source.c source.h
162 option, and creates a new archive with restricted pax format
163 and gzip compression,
164 .Dl Nm Fl a Fl jcf Pa archive.xxx source.c source.h
165 if it is unknown suffix or no suffix, creates a new archive with
166 restricted pax format and bzip2 compression.
167 .It Fl B , Fl Fl read-full-blocks
168 Ignored for compatibility with other
171 .It Fl b Ar blocksize , Fl Fl block-size Ar blocksize
172 Specify the block size, in 512-byte records, for tape drive I/O.
173 As a rule, this argument is only needed when reading from or writing
174 to tape drives, and usually not even then as the default block size of
175 20 records (10240 bytes) is very common.
176 .It Fl C Ar directory , Fl Fl cd Ar directory , Fl Fl directory Ar directory
177 In c and r mode, this changes the directory before adding
179 In x mode, change directories after opening the archive
180 but before extracting entries from the archive.
184 to the current directory after processing any
186 options and before extracting any files.
187 .It Fl Fl clear-nochange-fflags
189 Before removing file system objects to replace them, clear platform-specific
190 file flags that might prevent removal.
191 .It Fl Fl disable-copyfile
195 .It Fl Fl exclude Ar pattern
196 Do not process files or directories that match the
198 Note that exclusions take precedence over patterns or filenames
199 specified on the command line.
200 .It Fl Fl format Ar format
202 Use the specified format for the created archive.
203 Supported formats include
209 Other formats may also be supported; see
210 .Xr libarchive-formats 5
211 for more information about currently-supported formats.
212 In r and u modes, when extending an existing archive, the format specified
213 here must be compatible with the format of the existing archive on disk.
214 .It Fl f Ar file , Fl Fl file Ar file
215 Read the archive from or write the archive to the specified file.
218 for standard input or standard output.
219 The default varies by system;
224 on Linux, the default is
227 Use the provided group id number.
228 On extract, this overrides the group id in the archive;
229 the group name in the archive will be ignored.
230 On create, this overrides the group id read from disk;
233 is not also specified, the group name will be set to
235 .It Fl Fl gname Ar name
236 Use the provided group name.
237 On extract, this overrides the group name in the archive;
238 if the provided group name does not exist on the system,
240 (from the archive or from the
243 will be used instead.
244 On create, this sets the group name that will be stored
246 the name will not be verified against the system group database.
249 Symbolic links named on the command line will be followed; the
250 target of the link will be archived, not the link itself.
260 .It Fl Fl hfsCompression
262 Mac OS X specific(v10.6 or later). Compress extracted regular files with HFS+ compression.
263 .It Fl Fl ignore-zeros
265 .Fl Fl options Cm read_concatenated_archives
266 for compatibility with GNU tar.
267 .It Fl Fl include Ar pattern
268 Process only files or directories that match the specified pattern.
269 Note that exclusions specified with
271 take precedence over inclusions.
272 If no inclusions are explicitly specified, all entries are processed by
276 option is especially useful when filtering archives.
277 For example, the command
278 .Dl Nm Fl c Fl f Pa new.tar Fl Fl include='*foo*' Cm @ Ns Pa old.tgz
279 creates a new archive
281 containing only the entries from
283 containing the string
287 Compress the resulting archive with
289 In extract or list modes, this option is ignored.
290 Note that, unlike other
292 implementations, this implementation recognizes XZ compression
293 automatically when reading archives.
294 .It Fl j , Fl Fl bzip , Fl Fl bzip2 , Fl Fl bunzip2
296 Compress the resulting archive with
298 In extract or list modes, this option is ignored.
299 Note that, unlike other
301 implementations, this implementation recognizes bzip2 compression
302 automatically when reading archives.
303 .It Fl k , Fl Fl keep-old-files
305 Do not overwrite existing files.
306 In particular, if a file appears more than once in an archive,
307 later copies will not overwrite earlier copies.
308 .It Fl Fl keep-newer-files
310 Do not overwrite existing files that are newer than the
311 versions appearing in the archive being extracted.
312 .It Fl L , Fl Fl dereference
314 All symbolic links will be followed.
315 Normally, symbolic links are archived as such.
316 With this option, the target of the link will be archived instead.
317 .It Fl l , Fl Fl check-links
319 Issue a warning message unless all links to each file are archived.
322 Compress the resulting archive with
324 In extract or list modes, this option is ignored.
327 Compress the archive with lz4-compatible compression before writing it.
328 In input mode, this option is ignored; lz4 compression is recognized
329 automatically on input.
331 (c mode only) Compress the resulting archive with the original LZMA algorithm.
332 Use of this option is discouraged and new archives should be created with
335 Note that, unlike other
337 implementations, this implementation recognizes LZMA compression
338 automatically when reading archives.
341 Compress the resulting archive with
343 In extract or list modes, this option is ignored.
344 .It Fl m , Fl Fl modification-time
346 Do not extract modification time.
347 By default, the modification time is set to the time stored in the archive.
348 .It Fl n , Fl Fl norecurse , Fl Fl no-recursion
350 Do not recursively archive the contents of directories.
351 .It Fl Fl newer Ar date
353 Only include files and directories newer than the specified date.
354 This compares ctime entries.
355 .It Fl Fl newer-mtime Ar date
359 except it compares mtime entries instead of ctime entries.
360 .It Fl Fl newer-than Pa file
362 Only include files and directories newer than the specified file.
363 This compares ctime entries.
364 .It Fl Fl newer-mtime-than Pa file
368 except it compares mtime entries instead of ctime entries.
371 Honor the nodump file flag by skipping this file.
372 .It Fl Fl nopreserveHFSCompression
374 Mac OS X specific(v10.6 or later). Do not compress extracted regular files
375 which were compressed with HFS+ compression before archived.
376 By default, compress the regular files again with HFS+ compression.
382 Filenames or patterns are separated by null characters,
384 This is often used to read filenames output by the
388 .It Fl Fl no-same-owner
390 Do not extract owner and group IDs.
391 This is the reverse of
393 and the default behavior if
396 .It Fl Fl no-same-permissions
398 Do not extract full permissions (SGID, SUID, sticky bit, ACLs,
399 extended attributes or extended file flags).
400 This is the reverse of
402 and the default behavior if
405 .It Fl Fl numeric-owner
406 This is equivalent to
411 On extract, it causes user and group names in the archive
412 to be ignored in favor of the numeric user and group ids.
413 On create, it causes user and group names to not be stored
415 .It Fl O , Fl Fl to-stdout
417 In extract (-x) mode, files will be written to standard out rather than
418 being extracted to disk.
419 In list (-t) mode, the file listing will be written to stderr rather than
423 Use the user and group of the user running the program rather
424 than those specified in the archive.
425 Note that this has no significance unless
427 is specified, and the program is being run by the root user.
428 In this case, the file modes and flags from
429 the archive will be restored, but ACLs or owner information in
430 the archive will be discarded.
434 .Fl Fl format Ar ustar
435 .It Fl Fl older Ar date
437 Only include files and directories older than the specified date.
438 This compares ctime entries.
439 .It Fl Fl older-mtime Ar date
443 except it compares mtime entries instead of ctime entries.
444 .It Fl Fl older-than Pa file
446 Only include files and directories older than the specified file.
447 This compares ctime entries.
448 .It Fl Fl older-mtime-than Pa file
452 except it compares mtime entries instead of ctime entries.
453 .It Fl Fl one-file-system
455 Do not cross mount points.
456 .It Fl Fl options Ar options
457 Select optional behaviors for particular modules.
458 The argument is a text string containing comma-separated
460 These are passed to the modules that handle particular
461 formats to control how those formats will behave.
462 Each option has one of the following forms:
463 .Bl -tag -compact -width indent
465 The key will be set to the specified value in every module that supports it.
466 Modules that do not support this key will ignore it.
468 The key will be enabled in every module that supports it.
469 This is equivalent to
472 The key will be disabled in every module that supports it.
473 .It Ar module:key=value , Ar module:key , Ar module:!key
474 As above, but the corresponding key and value will be provided
475 only to modules whose name matches
478 The currently supported modules and keys are:
479 .Bl -tag -compact -width indent
480 .It Cm iso9660:joliet
481 Support Joliet extensions.
482 This is enabled by default, use
487 .It Cm iso9660:rockridge
488 Support Rock Ridge extensions.
489 This is enabled by default, use
492 .Cm iso9660:!rockridge
494 .It Cm gzip:compression-level
495 A decimal integer from 1 to 9 specifying the gzip compression level.
496 .It Cm gzip:timestamp
497 Store timestamp. This is enabled by default, use
502 .It Cm lrzip:compression Ns = Ns Ar type
505 as compression method.
506 Supported values are bzip2, gzip, lzo (ultra fast),
507 and zpaq (best, extremely slow).
508 .It Cm lrzip:compression-level
509 A decimal integer from 1 to 9 specifying the lrzip compression level.
510 .It Cm lz4:compression-level
511 A decimal integer from 1 to 9 specifying the lzop compression level.
512 .It Cm lz4:stream-checksum
513 Enable stream checksum. This is by default, use
514 .Cm lz4:!stream-checksum
516 .It Cm lz4:block-checksum
517 Enable block checksum (Disabled by default).
518 .It Cm lz4:block-size
519 A decimal integer from 4 to 7 specifying the lz4 compression block size
520 (7 is set by default).
521 .It Cm lz4:block-dependence
522 Use the previous block of the block being compressed for
523 a compression dictionary to improve compression ratio.
524 .It Cm lzop:compression-level
525 A decimal integer from 1 to 9 specifying the lzop compression level.
526 .It Cm xz:compression-level
527 A decimal integer from 0 to 9 specifying the xz compression level.
528 .It Cm mtree: Ns Ar keyword
529 The mtree writer module allows you to specify which mtree keywords
530 will be included in the output.
531 Supported keywords include:
532 .Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent ,
533 .Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 ,
534 .Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname .
535 The default is equivalent to:
536 .Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
538 Enables all of the above keywords.
541 to disable all keywords.
547 Produce human-readable output by indenting options and splitting lines
548 to fit into 80 columns.
549 .It Cm zip:compression Ns = Ns Ar type
552 as compression method.
553 Supported values are store (uncompressed) and deflate (gzip algorithm).
554 .It Cm zip:encryption
555 Enable encryption using traditional zip encryption.
556 .It Cm zip:encryption Ns = Ns Ar type
560 Supported values are zipcrypt (traditional zip encryption),
561 aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryption).
562 .It Cm read_concatenated_archives
563 Ignore zeroed blocks in the archive, which occurs when multiple tar archives
564 have been concatenated together. Without this option, only the contents of
565 the first concatenated archive would be read. This option is comparable to
567 .Fl i , Fl Fl ignore-zeros
570 If a provided option is not supported by any module, that
572 .It Fl P , Fl Fl absolute-paths
574 By default, absolute pathnames (those that begin with a /
575 character) have the leading slash removed both when creating archives
576 and extracting from them.
579 will refuse to extract archive entries whose pathnames contain
581 or whose target directory would be altered by a symlink.
582 This option suppresses these behaviors.
583 .It Fl p , Fl Fl insecure , Fl Fl preserve-permissions
585 Preserve file permissions.
586 Attempt to restore the full permissions, including owner, file modes, file
587 flags and ACLs, if available, for each item extracted from the archive.
588 This is the default, if
590 is being run by root and can be overridden by also specifying
593 .Fl Fl no-same-permissions .
594 .It Fl Fl passphrase Ar passphrase
597 is used to extract or create an encrypted archive.
598 Currently, zip is the only supported format that supports encryption.
599 You shouldn't use this option unless you realize how insecure
600 use of this option is.
605 .It Fl q , Fl Fl fast-read
607 Extract or list only the first archive entry that matches each pattern
609 Exit as soon as each specified pattern or filename has been matched.
610 By default, the archive is always read to the very end, since
611 there can be multiple entries with the same name and, by convention,
612 later entries overwrite earlier entries.
613 This option is provided as a performance optimization.
616 Extract files as sparse files.
617 For every block on disk, check first if it contains only NULL bytes and seek
619 This works similar to the conv=sparse option of dd.
621 Modify file or archive member names according to
623 The pattern has the format
624 .Ar /old/new/ Ns Op ghHprRsS
627 is a basic regular expression,
629 is the replacement string of the matched part,
630 and the optional trailing letters modify
631 how the replacement is handled.
634 is not matched, the pattern is skipped.
637 ~ is substituted with the match, \e1 to \e9 with the content of
638 the corresponding captured group.
639 The optional trailing g specifies that matching should continue
640 after the matched part and stop on the first unmatched pattern.
641 The optional trailing s specifies that the pattern applies to the value
643 The optional trailing p specifies that after a successful substitution
644 the original path name and the new path name should be printed to
646 Optional trailing H, R, or S characters suppress substitutions
647 for hardlink targets, regular filenames, or symlink targets,
649 Optional trailing h, r, or s characters enable substitutions
650 for hardlink targets, regular filenames, or symlink targets,
654 which applies substitutions to all names.
655 In particular, it is never necessary to specify h, r, or s.
658 Extract owner and group IDs.
659 This is the reverse of
661 and the default behavior if
664 .It Fl Fl strip-components Ar count
665 Remove the specified number of leading path elements.
666 Pathnames with fewer elements will be silently skipped.
667 Note that the pathname is edited after checking inclusion/exclusion patterns
668 but before security checks.
669 .It Fl T Ar filename , Fl Fl files-from Ar filename
672 will read the list of names to be extracted from
676 will read names to be archived from
680 on a line by itself will cause the current directory to be changed to
681 the directory specified on the following line.
682 Names are terminated by newlines unless
687 also disables the special handling of lines containing
689 Note: If you are generating lists of files using
691 you probably want to use
696 After archiving all files, print a summary to stderr.
697 .It Fl U , Fl Fl unlink , Fl Fl unlink-first
699 Unlink files before creating them.
700 This can be a minor performance optimization if most files
701 already exist, but can make things slower if most files
702 do not already exist.
703 This flag also causes
705 to remove intervening directory symlinks instead of
707 See the SECURITY section below for more details.
709 Use the provided user id number and ignore the user
710 name from the archive.
713 is not also specified, the user name will be set to
715 .It Fl Fl uname Ar name
716 Use the provided user name.
717 On extract, this overrides the user name in the archive;
718 if the provided user name does not exist on the system,
719 it will be ignored and the user id
720 (from the archive or from the
723 will be used instead.
724 On create, this sets the user name that will be stored
726 the name is not verified against the system user database.
727 .It Fl Fl use-compress-program Ar program
728 Pipe the input (in x or t mode) or the output (in c mode) through
730 instead of using the builtin compression support.
731 .It Fl v , Fl Fl verbose
732 Produce verbose output.
733 In create and extract modes,
735 will list each file name as it is read from or written to
739 will produce output similar to that of
743 option will also provide ls-like details in create and extract mode.
750 .It Fl w , Fl Fl confirmation , Fl Fl interactive
751 Ask for confirmation for every action.
752 .It Fl X Ar filename , Fl Fl exclude-from Ar filename
753 Read a list of exclusion patterns from the specified file.
756 for more information about the handling of exclusions.
759 Compress the resulting archive with
761 In extract or list modes, this option is ignored.
762 Note that, unlike other
764 implementations, this implementation recognizes bzip2 compression
765 automatically when reading archives.
766 .It Fl Z , Fl Fl compress , Fl Fl uncompress
768 Compress the resulting archive with
770 In extract or list modes, this option is ignored.
771 Note that, unlike other
773 implementations, this implementation recognizes compress compression
774 automatically when reading archives.
775 .It Fl z , Fl Fl gunzip , Fl Fl gzip
777 Compress the resulting archive with
779 In extract or list modes, this option is ignored.
780 Note that, unlike other
782 implementations, this implementation recognizes gzip compression
783 automatically when reading archives.
786 The following environment variables affect the execution of
788 .Bl -tag -width ".Ev BLOCKSIZE"
789 .It Ev TAR_READER_OPTIONS
790 The default options for format readers and compression readers.
793 option overrides this.
794 .It Ev TAR_WRITER_OPTIONS
795 The default options for format writers and compression writers.
798 option overrides this.
803 for more information.
808 option overrides this.
809 Please see the description of the
811 option above for more details.
813 The timezone to use when displaying dates.
816 for more information.
821 The following creates a new archive
824 that contains two files
828 .Dl Nm Fl czf Pa file.tar.gz Pa source.c Pa source.h
830 To view a detailed table of contents for this
832 .Dl Nm Fl tvf Pa file.tar.gz
834 To extract all entries from the archive on
835 the default tape drive:
838 To examine the contents of an ISO 9660 cdrom image:
839 .Dl Nm Fl tf Pa image.iso
841 To move file hierarchies, invoke
844 .Dl Nm Fl cf Pa - Fl C Pa srcdir\ . | Nm Fl xpf Pa - Fl C Pa destdir
845 or more traditionally
846 .Dl cd srcdir \&; Nm Fl cf Pa -\ . | ( cd destdir \&; Nm Fl xpf Pa - )
848 In create mode, the list of files and directories to be archived
849 can also include directory change instructions of the form
851 and archive inclusions of the form
852 .Cm @ Ns Pa archive-file .
853 For example, the command line
854 .Dl Nm Fl c Fl f Pa new.tar Pa foo1 Cm @ Ns Pa old.tgz Cm -C Ns Pa /tmp Pa foo2
855 will create a new archive
860 from the current directory and add it to the output archive.
861 It will then read each entry from
863 and add those entries to the output archive.
864 Finally, it will switch to the
868 to the output archive.
872 format can be used to create an output archive with arbitrary ownership,
873 permissions, or names that differ from existing data on disk:
875 .Bd -literal -offset indent
878 usr/bin uid=0 gid=0 mode=0755 type=dir
879 usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
880 $ tar -cvf output.tar @input.mtree
887 switches accept a variety of common date and time specifications, including
888 .Dq 12 Mar 2005 7:14:29pm ,
889 .Dq 2005-03-12 19:14 ,
892 .Dq 19:14 PST May 1 .
896 argument can be used to control various details of archive generation
898 For example, you can generate mtree output which only contains
903 .Dl Nm Fl cf Pa file.tar Fl Fl format=mtree Fl Fl options='!all,type,time,uid' Pa dir
904 or you can set the compression level used by gzip or xz compression:
905 .Dl Nm Fl czf Pa file.tar Fl Fl options='compression-level=9' .
906 For more details, see the explanation of the
907 .Fn archive_read_set_options
909 .Fn archive_write_set_options
910 API calls that are described in
913 .Xr archive_write 3 .
915 The bundled-arguments format is supported for compatibility
916 with historic implementations.
917 It consists of an initial word (with no leading - character) in which
918 each character indicates an option.
919 Arguments follow as separate words.
920 The order of the arguments must match the order
921 of the corresponding characters in the bundled command word.
923 .Dl Nm Cm tbf 32 Pa file.tar
924 specifies three flags
933 flags both require arguments,
934 so there must be two additional items
938 is the argument to the
942 is the argument to the
946 The mode options c, r, t, u, and x and the options
947 b, f, l, m, o, v, and w comply with SUSv2.
949 For maximum portability, scripts that invoke
951 should use the bundled-argument format above, should limit
966 Additional long options are provided to improve compatibility with other
969 Certain security issues are common to many archiving programs, including
971 In particular, carefully-crafted archives can request that
973 extract files to locations outside of the target directory.
974 This can potentially be used to cause unwitting users to overwrite
975 files they did not intend to overwrite.
976 If the archive is being extracted by the superuser, any file
977 on the system can potentially be overwritten.
978 There are three ways this can happen.
981 has mechanisms to protect against each one,
982 savvy users should be aware of the implications:
983 .Bl -bullet -width indent
985 Archive entries can have absolute pathnames.
990 character from filenames before restoring them to guard against this problem.
992 Archive entries can have pathnames that include
997 will not extract files containing
999 components in their pathname.
1001 Archive entries can exploit symbolic links to restore
1002 files to other directories.
1003 An archive can restore a symbolic link to another directory,
1004 then use that link to restore a file into that directory.
1005 To guard against this,
1007 checks each extracted path for symlinks.
1008 If the final path element is a symlink, it will be removed
1009 and replaced with the archive entry.
1012 is specified, any intermediate symlink will also be unconditionally removed.
1019 will refuse to extract the entry.
1021 To protect yourself, you should be wary of any archives that
1022 come from untrusted sources.
1023 You should examine the contents of an archive with
1024 .Dl Nm Fl tf Pa filename
1028 option to ensure that
1030 will not overwrite any existing files or the
1032 option to remove any pre-existing files.
1033 You should generally not extract archives while running with super-user
1039 disables the security checks above and allows you to extract
1040 an archive while preserving any absolute pathnames,
1042 components, or symlinks to other directories.
1053 .Xr libarchive-formats 5 ,
1056 There is no current POSIX standard for the tar command; it appeared
1059 but was dropped from
1061 The options supported by this implementation were developed by surveying a
1062 number of existing tar implementations as well as the old POSIX specification
1063 for tar and the current POSIX specification for pax.
1065 The ustar and pax interchange file formats are defined by
1067 for the pax command.
1071 command appeared in Seventh Edition Unix, which was released in January, 1979.
1072 There have been numerous other implementations,
1073 many of which extended the file format.
1076 public-domain implementation (circa November, 1987)
1077 was quite influential, and formed the basis of GNU tar.
1078 GNU tar was included as the standard system tar
1084 This is a complete re-implementation based on the
1087 It was first released with
1091 This program follows
1093 for the definition of the
1096 Note that GNU tar prior to version 1.15 treated
1098 as a synonym for the
1099 .Fl Fl one-file-system
1104 option may differ from historic implementations.
1106 All archive output is written in correctly-sized blocks, even
1107 if the output is being compressed.
1108 Whether or not the last output block is padded to a full
1109 block size varies depending on the format and the
1111 For tar and cpio formats, the last block of output is padded
1112 to a full block size if the output is being
1113 written to standard output or to a character or block device such as
1115 If the output is being written to a regular file, the last block
1117 Many compressors, including
1121 complain about the null padding when decompressing an archive created by
1123 although they still extract it correctly.
1125 The compression and decompression is implemented internally, so
1126 there may be insignificant differences between the compressed output
1128 .Dl Nm Fl czf Pa - file
1129 and that generated by
1130 .Dl Nm Fl cf Pa - file | Nm gzip
1132 The default should be to read and write archives to the standard I/O paths,
1133 but tradition (and POSIX) dictates otherwise.
1139 modes require that the archive be uncompressed
1140 and located in a regular file on disk.
1141 Other archives can be modified using
1147 To archive a file called
1151 you must specify it as
1157 In create mode, a leading
1162 is stripped unless the
1164 option is specified.
1166 There needs to be better support for file selection on both create
1169 There is not yet any support for multi-volume archives.
1171 Converting between dissimilar archive formats (such as tar and cpio) using the
1173 convention can cause hard link information to be lost.
1174 (This is a consequence of the incompatible ways that different archive
1175 formats store hardlink information.)