head 1.14; access; symbols libarchive-3-8-7:1.1.1.16 libarchive-3-8-6:1.1.1.16 pkgsrc-2026Q1:1.14.0.8 pkgsrc-2026Q1-base:1.14 libarchive-3-8-5:1.1.1.16 libarchive-3-8-4:1.1.1.16 pkgsrc-2025Q4:1.14.0.6 pkgsrc-2025Q4-base:1.14 libarchive-3-8-3:1.1.1.16 libarchive-3-8-2:1.1.1.16 pkgsrc-2025Q3:1.14.0.4 pkgsrc-2025Q3-base:1.14 libarchive-3-8-1:1.1.1.16 pkgsrc-2025Q2:1.14.0.2 pkgsrc-2025Q2-base:1.14 libarchive-3-8-0:1.1.1.16 libarchive-3-7-9:1.1.1.15 pkgsrc-2025Q1:1.12.0.4 pkgsrc-2025Q1-base:1.12 pkgsrc-2024Q4:1.12.0.2 pkgsrc-2024Q4-base:1.12 libarchive-3-7-7:1.1.1.14 pkgsrc-2024Q3:1.11.0.4 pkgsrc-2024Q3-base:1.11 libarchive-3-7-5:1.1.1.13 pkgsrc-2024Q2:1.11.0.2 pkgsrc-2024Q2-base:1.11 libarchive-3-7-4:1.1.1.13 libarchive-3-7-3:1.1.1.12 pkgsrc-2024Q1:1.9.0.2 pkgsrc-2024Q1-base:1.9 libarchive-3-7-2:1.1.1.11 pkgsrc-2023Q4:1.8.0.30 pkgsrc-2023Q4-base:1.8 pkgsrc-2023Q3:1.8.0.28 pkgsrc-2023Q3-base:1.8 pkgsrc-2023Q2:1.8.0.26 pkgsrc-2023Q2-base:1.8 pkgsrc-2023Q1:1.8.0.24 pkgsrc-2023Q1-base:1.8 pkgsrc-2022Q4:1.8.0.22 pkgsrc-2022Q4-base:1.8 pkgsrc-2022Q3:1.8.0.20 pkgsrc-2022Q3-base:1.8 pkgsrc-2022Q2:1.8.0.18 pkgsrc-2022Q2-base:1.8 pkgsrc-2022Q1:1.8.0.16 pkgsrc-2022Q1-base:1.8 pkgsrc-2021Q4:1.8.0.14 pkgsrc-2021Q4-base:1.8 pkgsrc-2021Q3:1.8.0.12 pkgsrc-2021Q3-base:1.8 pkgsrc-2021Q2:1.8.0.10 pkgsrc-2021Q2-base:1.8 pkgsrc-2021Q1:1.8.0.8 pkgsrc-2021Q1-base:1.8 pkgsrc-2020Q4:1.8.0.6 pkgsrc-2020Q4-base:1.8 pkgsrc-2020Q3:1.8.0.4 pkgsrc-2020Q3-base:1.8 pkgsrc-2020Q2:1.8.0.2 pkgsrc-2020Q2-base:1.8 pkgsrc-2020Q1:1.7.0.4 pkgsrc-2020Q1-base:1.7 pkgsrc-2019Q4:1.7.0.6 pkgsrc-2019Q4-base:1.7 pkgsrc-2019Q3:1.7.0.2 pkgsrc-2019Q3-base:1.7 libarchive-3-4-0:1.1.1.10 libarchive-3-3-3:1.1.1.9 pkgsrc-2019Q2:1.6.0.2 pkgsrc-2019Q2-base:1.6 pkgsrc-2019Q1:1.5.0.16 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.5.0.14 pkgsrc-2018Q4-base:1.5 pkgsrc-2018Q3:1.5.0.12 pkgsrc-2018Q3-base:1.5 pkgsrc-2018Q2:1.5.0.10 pkgsrc-2018Q2-base:1.5 pkgsrc-2018Q1:1.5.0.8 pkgsrc-2018Q1-base:1.5 pkgsrc-2017Q4:1.5.0.6 pkgsrc-2017Q4-base:1.5 pkgsrc-2017Q3:1.5.0.4 pkgsrc-2017Q3-base:1.5 libarchive-3-3-2:1.1.1.8 pkgsrc-2017Q2:1.4.0.4 pkgsrc-2017Q2-base:1.4 pkgsrc-2017Q1:1.4.0.2 pkgsrc-2017Q1-base:1.4 libarchive-3-3-1:1.1.1.7 pkgsrc-2016Q4:1.3.0.6 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.4 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.2 pkgsrc-2016Q2-base:1.3 libarchive-3-2-1:1.1.1.6 pkgsrc-2016Q1:1.2.0.10 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.8 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.6 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.4 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.2 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.1.1.5.0.36 pkgsrc-2014Q4-base:1.1.1.5 pkgsrc-2014Q3:1.1.1.5.0.34 pkgsrc-2014Q3-base:1.1.1.5 pkgsrc-2014Q2:1.1.1.5.0.32 pkgsrc-2014Q2-base:1.1.1.5 pkgsrc-2014Q1:1.1.1.5.0.30 pkgsrc-2014Q1-base:1.1.1.5 pkgsrc-2013Q4:1.1.1.5.0.28 pkgsrc-2013Q4-base:1.1.1.5 pkgsrc-2013Q3:1.1.1.5.0.26 pkgsrc-2013Q3-base:1.1.1.5 pkgsrc-2013Q2:1.1.1.5.0.24 pkgsrc-2013Q2-base:1.1.1.5 pkgsrc-2013Q1:1.1.1.5.0.22 pkgsrc-2013Q1-base:1.1.1.5 pkgsrc-2012Q4:1.1.1.5.0.20 pkgsrc-2012Q4-base:1.1.1.5 pkgsrc-2012Q3:1.1.1.5.0.18 pkgsrc-2012Q3-base:1.1.1.5 pkgsrc-2012Q2:1.1.1.5.0.16 pkgsrc-2012Q2-base:1.1.1.5 pkgsrc-2012Q1:1.1.1.5.0.14 pkgsrc-2012Q1-base:1.1.1.5 pkgsrc-2011Q4:1.1.1.5.0.12 pkgsrc-2011Q4-base:1.1.1.5 pkgsrc-2011Q3:1.1.1.5.0.10 pkgsrc-2011Q3-base:1.1.1.5 pkgsrc-2011Q2:1.1.1.5.0.8 pkgsrc-2011Q2-base:1.1.1.5 pkgsrc-2011Q1:1.1.1.5.0.6 pkgsrc-2011Q1-base:1.1.1.5 pkgsrc-2010Q4:1.1.1.5.0.4 pkgsrc-2010Q4-base:1.1.1.5 pkgsrc-2010Q3:1.1.1.5.0.2 pkgsrc-2010Q3-base:1.1.1.5 libarchive-2-8-4:1.1.1.5 pkgsrc-2010Q2:1.1.1.4.0.4 pkgsrc-2010Q2-base:1.1.1.4 pkgsrc-2010Q1:1.1.1.4.0.2 pkgsrc-2010Q1-base:1.1.1.4 libarchive-2-8-3:1.1.1.4 libarchive-2-8-2:1.1.1.3 libarchive-2-8-0:1.1.1.2 pkgsrc-2009Q4:1.1.1.1.0.22 pkgsrc-2009Q4-base:1.1.1.1 pkgsrc-2009Q3:1.1.1.1.0.20 pkgsrc-2009Q3-base:1.1.1.1 pkgsrc-2009Q2:1.1.1.1.0.18 pkgsrc-2009Q2-base:1.1.1.1 pkgsrc-2009Q1:1.1.1.1.0.16 pkgsrc-2009Q1-base:1.1.1.1 pkgsrc-2008Q4:1.1.1.1.0.14 pkgsrc-2008Q4-base:1.1.1.1 pkgsrc-2008Q3:1.1.1.1.0.12 pkgsrc-2008Q3-base:1.1.1.1 cube-native-xorg:1.1.1.1.0.10 cube-native-xorg-base:1.1.1.1 pkgsrc-2008Q2:1.1.1.1.0.8 pkgsrc-2008Q2-base:1.1.1.1 cwrapper:1.1.1.1.0.6 pkgsrc-2008Q1:1.1.1.1.0.4 pkgsrc-2008Q1-base:1.1.1.1 pkgsrc-2007Q4:1.1.1.1.0.2 pkgsrc-2007Q4-base:1.1.1.1 libarchive-2-4-0:1.1.1.1 KIENTZLE:1.1.1; locks; strict; comment @# @; 1.14 date 2025.05.21.15.25.50; author adam; state Exp; branches; next 1.13; commitid 6aTN21WjRYk8TMVF; 1.13 date 2025.04.28.10.31.34; author adam; state Exp; branches; next 1.12; commitid Tocq615J6mYPZNSF; 1.12 date 2024.10.19.05.39.58; author adam; state Exp; branches; next 1.11; commitid fYRSlpIWMYluweuF; 1.11 date 2024.04.30.06.05.19; author adam; state Exp; branches; next 1.10; commitid id0E8i4RwCC4c88F; 1.10 date 2024.04.12.15.39.50; author adam; state Exp; branches; next 1.9; commitid 52ilmjFHKDf0XR5F; 1.9 date 2024.01.18.18.00.16; author adam; state Exp; branches; next 1.8; commitid hNXpsHx3SuHqsXUE; 1.8 date 2020.05.26.09.16.41; author nia; state Exp; branches; next 1.7; commitid nNhsdZACz3PjmJ9C; 1.7 date 2019.09.22.09.55.08; author joerg; state Exp; branches; next 1.6; commitid FdPvRjF4OzwBwZDB; 1.6 date 2019.04.10.08.24.05; author adam; state Exp; branches; next 1.5; commitid LnliQ9ieqYkikMiB; 1.5 date 2017.08.01.22.26.23; author joerg; state Exp; branches; next 1.4; commitid 32clTfkmVE8bPy1A; 1.4 date 2017.02.25.21.11.19; author joerg; state Exp; branches; next 1.3; commitid rW8QfCWrsCO1snHz; 1.3 date 2016.06.20.17.24.57; author joerg; state Exp; branches; next 1.2; commitid ArUvympBjfBseebz; 1.2 date 2015.01.17.12.44.49; author adam; state Exp; branches; next 1.1; commitid yy7e1hLrfmA2pn6y; 1.1 date 2007.11.30.21.25.33; author joerg; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2007.11.30.21.25.33; author joerg; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2010.02.20.03.50.05; author joerg; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2010.03.14.17.57.22; author joerg; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2010.03.16.17.07.36; author joerg; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2010.07.09.11.53.32; author joerg; state Exp; branches; next 1.1.1.6; 1.1.1.6 date 2016.06.20.17.12.02; author joerg; state Exp; branches; next 1.1.1.7; commitid rRgm3BqbmbI8aebz; 1.1.1.7 date 2017.02.25.20.54.12; author joerg; state Exp; branches; next 1.1.1.8; commitid ReqPI0ibLYjdmnHz; 1.1.1.8 date 2017.08.01.22.21.12; author joerg; state Exp; branches; next 1.1.1.9; commitid XQwPAFJku336Ny1A; 1.1.1.9 date 2019.09.22.09.47.03; author joerg; state Exp; branches; next 1.1.1.10; commitid N0KxAXOYyULduZDB; 1.1.1.10 date 2019.09.22.09.51.33; author joerg; state Exp; branches; next 1.1.1.11; commitid 5kDbfPbiV3INvZDB; 1.1.1.11 date 2024.01.18.17.37.45; author adam; state Exp; branches; next 1.1.1.12; commitid zDULEPUODGjTkXUE; 1.1.1.12 date 2024.04.12.15.27.44; author adam; state Exp; branches; next 1.1.1.13; commitid tQWTddCoxBumSR5F; 1.1.1.13 date 2024.04.30.05.50.49; author adam; state Exp; branches; next 1.1.1.14; commitid e4DnFoZdQV9Z688F; 1.1.1.14 date 2024.10.19.05.27.34; author adam; state Exp; branches; next 1.1.1.15; commitid v1iXM4j1Na52seuF; 1.1.1.15 date 2025.04.28.09.44.10; author adam; state Exp; branches; next 1.1.1.16; commitid 1zB7ffc4d2qCJNSF; 1.1.1.16 date 2025.05.21.15.11.28; author adam; state Exp; branches; next ; commitid Nzqt2UgtvkVXNMVF; desc @@ 1.14 log @libarchive bsdtar: updated to 3.8.0 Libarchive 3.8.0 is a feature and bugfix release. New features: bsdtar: support --mtime and --clamp-mtime lib: mbedtls 3.x compatibility 7-zip reader: improve self-extracting archive detection xar: xmllite support for the XAR reader and writer zip writer: added XZ, LZMA, ZSTD and BZIP2 support zip writer: added LZMA + RISCV BCJ filter Notable security fixes: rar: do not skip past EOF while reading rar: fix double free with over 4 billion nodes rar: fix heap-buffer-overflow warc: prevent signed integer overflow tar: fix overflow in build_ustar_entry Notable bugfixes: bsdtar: don't hardlink negative inode files together gz: allow setting the original filename for gzip compressed files lib: improve lseek handling lib: support @@-prefixed Unix epoch timestamps as date strings rar: support large headers on 32 bit systems tar reader: Improve LFS support on 32 bit systems @ text @4mTAR24m(1) General Commands Manual 4mTAR24m(1) 1mNAME0m tar — manipulate tape archives 1mSYNOPSIS0m 1mtar 22m[4mbundled-flags24m ⟨args⟩] [⟨4mfile24m⟩ | ⟨4mpattern24m⟩ ...] 1mtar 22m{1m-c22m} [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-r 22m| 1m-u22m} 1m-f 4m22marchive-file24m [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-t 22m| 1m-x22m} [4moptions24m] [4mpatterns24m] 1mDESCRIPTION0m 1mtar 22mcreates and manipulates streaming archive files. This implementa‐ tion can extract from tar, pax, cpio, zip, jar, ar, xar, rar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives. The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See “COMPATIBILITY” below for details. The other synopsis forms show the preferred usage. The first option to 1mtar 22mis a mode indicator from the following list: 1m-c 22mCreate a new archive containing the specified items. The long option form is 1m--create22m. 1m-r 22mLike 1m-c22m, but new entries are appended to the archive. Note that this only works on uncompressed archives stored in regular files. The 1m-f 22moption is required. The long option form is 1m--append22m. 1m-t 22mList archive contents to stdout. The long option form is 1m--list22m. 1m-u 22mLike 1m-r22m, but new entries are added only if they have a modifi‐ cation date newer than the corresponding entry in the archive. Note that this only works on uncompressed archives stored in regular files. The 1m-f 22moption is required. The long form is 1m--update22m. 1m-x 22mExtract to disk from the archive. If a file with the same name appears more than once in the archive, each copy will be ex‐ tracted, with later copies overwriting (replacing) earlier copies. The long option form is 1m--extract22m. In 1m-c22m, 1m-r22m, or 1m-u 22mmode, each specified file or directory is added to the archive in the order specified on the command line. By default, the contents of each directory are also archived. In extract or list mode, the entire command line is read and parsed be‐ fore the archive is opened. The pathnames or patterns on the command line indicate which items in the archive should be processed. Patterns are shell-style globbing patterns as documented in 4mtcsh24m(1). 1mOPTIONS0m Unless specifically stated otherwise, options are applicable in all op‐ erating modes. 1m@@4m22marchive0m (c and r modes only) The specified archive is opened and the entries in it will be appended to the current archive. As a simple example, 1mtar -c -f 4m22m-24m 4mnewfile24m 1m@@4m22moriginal.tar0m writes a new archive to standard output containing a file 4mnewfile24m and all of the entries from 4moriginal.tar24m. In contrast, 1mtar -c -f 4m22m-24m 4mnewfile24m 4moriginal.tar0m creates a new archive with only two entries. Similarly, 1mtar -czf 4m22m-24m 1m--format pax @@4m22m-0m reads an archive from standard input (whose format will be de‐ termined automatically) and converts it into a gzip-compressed pax-format archive on stdout. In this way, 1mtar 22mcan be used to convert archives from one format to another. 1m-a22m, 1m--auto-compress0m (c mode only) Use the archive suffix to decide a set of the format and the compressions. As a simple example, 1mtar -a -cf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m creates a new archive with restricted pax format and gzip com‐ pression, 1mtar -a -cf 4m22marchive.tar.bz2.uu24m 4msource.c24m 4msource.h0m creates a new archive with restricted pax format and bzip2 com‐ pression and uuencode compression, 1mtar -a -cf 4m22marchive.zip24m 4msource.c24m 4msource.h0m creates a new archive with zip format, 1mtar -a -jcf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m ignores the “-j” option, and creates a new archive with re‐ stricted pax format and gzip compression, 1mtar -a -jcf 4m22marchive.xxx24m 4msource.c24m 4msource.h0m if it is unknown suffix or no suffix, creates a new archive with restricted pax format and bzip2 compression. 1m--acls 22m(c, r, u, x modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--no-acls 22mand the default behav‐ ior in c, r, and u modes (except on Mac OS X) or if 1mtar 22mis run in x mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the 1m--mac-metadata0m option is preferred. 1m-B22m, 1m--read-full-blocks0m Ignored for compatibility with other 4mtar24m(1) implementations. 1m-b 4m22mblocksize24m, 1m--block-size 4m22mblocksize0m Specify the block size, in 512-byte records, for tape drive I/O. As a rule, this argument is only needed when reading from or writing to tape drives, and usually not even then as the de‐ fault block size of 20 records (10240 bytes) is very common. 1m-C 4m22mdirectory24m, 1m--cd 4m22mdirectory24m, 1m--directory 4m22mdirectory0m In c and r mode, this changes the directory before adding the following files. In x mode, change directories after opening the archive but before extracting entries from the archive. 1m--chroot0m (x mode only) 1mchroot22m() to the current directory after process‐ ing any 1m-C 22moptions and before extracting any files. 1m--clamp-mtime0m (use with 1m--mtime22m) Only set the modification time if the file is newer than the date specified in 1m--mtime22m. 1m--clear-nochange-fflags0m (x mode only) Before removing file system objects to replace them, clear platform-specific file attributes or file flags that might prevent removal. 1m--exclude 4m22mpattern0m Do not process files or directories that match the specified pattern. Note that exclusions take precedence over patterns or filenames specified on the command line. 1m--exclude-vcs0m Do not process files or directories internally used by the ver‐ sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’, ‘Mercurial’, ‘RCS’, ‘SCCS’, ‘SVN’ and ‘git’. 1m--fflags0m (c, r, u, x modes only) Archive or extract platform-specific file attributes or file flags. This is the reverse of 1m--no-fflags 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. 1m--format 4m22mformat0m (c, r, u mode only) Use the specified format for the created archive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see 4mlibarchive-formats24m(5) for more information about currently-sup‐ ported formats. In r and u modes, when extending an existing archive, the format specified here must be compatible with the format of the existing archive on disk. 1m-f 4m22mfile24m, 1m--file 4m22mfile0m Read the archive from or write the archive to the specified file. The filename can be 4m-24m for standard input or standard output. The default varies by system; on FreeBSD, the default is 4m/dev/sa024m; on Linux, the default is 4m/dev/st024m. 1m--gid 4m22mid0m Use the provided group id number. On extract, this overrides the group id in the archive; the group name in the archive will be ignored. On create, this overrides the group id read from disk; if 1m--gname 22mis not also specified, the group name will be set to match the group id. 1m--gname 4m22mname0m Use the provided group name. On extract, this overrides the group name in the archive; if the provided group name does not exist on the system, the group id (from the archive or from the 1m--gid 22moption) will be used instead. On create, this sets the group name that will be stored in the archive; the name will not be verified against the system group database. 1m--group 4m22mname24m[:4mgid24m] Use the provided group, if 4mgid24m is not provided, 4mname24m can be ei‐ ther a group name or numeric id. See the 1m--gname 22moption for details. 1m-H 22m(c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not the link itself. 1m-h 22m(c and r modes only) Synonym for 1m-L22m. 1m-I 22mSynonym for 1m-T22m. 1m--help 22mShow usage. 1m--hfsCompression0m (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ tracted regular files with HFS+ compression. 1m--ignore-zeros0m An alias of 1m--options read_concatenated_archives 22mfor compati‐ bility with GNU tar. 1m--include 4m22mpattern0m Process only files or directories that match the specified pat‐ tern. Note that exclusions specified with 1m--exclude 22mtake precedence over inclusions. If no inclusions are explicitly specified, all entries are processed by default. The 1m--include0m option is especially useful when filtering archives. For exam‐ ple, the command 1mtar -c -f 4m22mnew.tar24m 1m--include='*foo*' @@4m22mold.tgz0m creates a new archive 4mnew.tar24m containing only the entries from 4mold.tgz24m containing the string ‘foo’. 1m-J22m, 1m--xz0m (c mode only) Compress the resulting archive with 4mxz24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes XZ compression automatically when reading archives. 1m-j22m, 1m--bzip22m, 1m--bzip222m, 1m--bunzip20m (c mode only) Compress the resulting archive with 4mbzip224m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically when reading archives. 1m-k22m, 1m--keep-old-files0m (x mode only) Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies. 1m--keep-newer-files0m (x mode only) Do not overwrite existing files that are newer than the versions appearing in the archive being extracted. 1m-L22m, 1m--dereference0m (c and r modes only) All symbolic links will be followed. Nor‐ mally, symbolic links are archived as such. With this option, the target of the link will be archived instead. 1m-l22m, 1m--check-links0m (c and r modes only) Issue a warning message unless all links to each file are archived. 1m--lrzip0m (c mode only) Compress the resulting archive with 4mlrzip24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lrzip compression automatically when reading archives. 1m--lz4 22m(c mode only) Compress the archive with lz4-compatible compres‐ sion before writing it. In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lz4 compression automatically when reading archives. 1m--zstd 22m(c mode only) Compress the archive with zstd-compatible com‐ pression before writing it. In extract or list modes, this op‐ tion is ignored. Note that this 1mtar 22mimplementation recognizes zstd compression automatically when reading archives. 1m--lzma 22m(c mode only) Compress the resulting archive with the original LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives should be created with 1m--xz 22minstead. Note that this 1mtar 22mimple‐ mentation recognizes LZMA compression automatically when read‐ ing archives. 1m--lzop 22m(c mode only) Compress the resulting archive with 4mlzop24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes LZO compression automatically when reading archives. 1m-m22m, 1m--modification-time0m (x mode only) Do not extract modification time. By default, the modification time is set to the time stored in the archive. 1m--mac-metadata0m (c, r, u and x mode only) Mac OS X specific. Archive or ex‐ tract extended ACLs and extended file attributes using 4mcopyfile24m(3) in AppleDouble format. This is the reverse of 1m--no-mac-metadata22m. and the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. Currently supported only for pax formats (including pax restricted, the default tar format for 1mbsdtar22m) 1m--mtime 4m22mdate0m (c, r, u modes only) Set the modification times of added files to the specified date. 1m-n22m, 1m--norecurse22m, 1m--no-recursion0m Do not operate recursively on the content of directories. 1m--newer 4m22mdate0m (c, r, u modes only) Only include files and directories newer than the specified date. This compares ctime entries. 1m--newer-mtime 4m22mdate0m (c, r, u modes only) Like 1m--newer22m, except it compares mtime en‐ tries instead of ctime entries. 1m--newer-than 4m22mfile0m (c, r, u modes only) Only include files and directories newer than the specified file. This compares ctime entries. 1m--newer-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--newer-than22m, except it compares mtime entries instead of ctime entries. 1m--nodump0m (c and r modes only) Honor the nodump file flag by skipping this file. 1m--nopreserveHFSCompression0m (x mode only) Mac OS X specific (v10.6 or later). Do not com‐ press extracted regular files which were compressed with HFS+ compression before archived. By default, compress the regular files again with HFS+ compression. 1m--null 22m(use with 1m-I 22mor 1m-T22m) Filenames or patterns are separated by null characters, not by newlines. This is often used to read file‐ names output by the 1m-print0 22moption to 4mfind24m(1). 1m--no-acls0m (c, r, u, x modes only) Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--acls 22mand the default be‐ havior if 1mtar 22mis run as non-root in x mode (on Mac OS X as any user in c, r, u and x modes). 1m--no-fflags0m (c, r, u, x modes only) Do not archive or extract file attrib‐ utes or file flags. This is the reverse of 1m--fflags 22mand the default behavior if 1mtar 22mis run as non-root in x mode. 1m--no-mac-metadata0m (c, r, u and x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using 4mcopyfile24m(3) in AppleDouble format. This is the reverse of 1m--mac-metadata22m. and the default behavior if 1mtar 22mis run as non-root in x mode. 1m--no-read-sparse0m (c, r, u modes only) Do not read sparse file information from disk. This is the reverse of 1m--read-sparse22m. 1m--no-safe-writes0m (x mode only) Do not create temporary files and use 4mrename24m(2) to replace the original ones. This is the reverse of 1m--safe-writes22m. 1m--no-same-owner0m (x mode only) Do not extract owner and group IDs. This is the reverse of 1m--same-owner 22mand the default behavior if 1mtar 22mis run as non-root. 1m--no-same-permissions0m (x mode only) Do not extract full permissions (SGID, SUID, sticky bit, file attributes or file flags, extended file at‐ tributes and ACLs). This is the reverse of 1m-p 22mand the default behavior if 1mtar 22mis run as non-root. 1m--no-xattrs0m (c, r, u, x modes only) Do not archive or extract extended file attributes. This is the reverse of 1m--xattrs 22mand the default behavior if 1mtar 22mis run as non-root in x mode. 1m--numeric-owner0m This is equivalent to 1m--uname 22m"" 1m--gname 22m"". On extract, it causes user and group names in the archive to be ignored in fa‐ vor of the numeric user and group ids. On create, it causes user and group names to not be stored in the archive. 1m-O22m, 1m--to-stdout0m (x, t modes only) In extract (-x) mode, files will be written to standard out rather than being extracted to disk. In list (-t) mode, the file listing will be written to stderr rather than the usual stdout. 1m-o 22m(x mode) Use the user and group of the user running the program rather than those specified in the archive. Note that this has no significance unless 1m-p 22mis specified, and the program is be‐ ing run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner in‐ formation in the archive will be discarded. 1m-o 22m(c, r, u mode) A synonym for 1m--format 4m22mustar0m 1m--older 4m22mdate0m (c, r, u modes only) Only include files and directories older than the specified date. This compares ctime entries. 1m--older-mtime 4m22mdate0m (c, r, u modes only) Like 1m--older22m, except it compares mtime en‐ tries instead of ctime entries. 1m--older-than 4m22mfile0m (c, r, u modes only) Only include files and directories older than the specified file. This compares ctime entries. 1m--older-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--older-than22m, except it compares mtime entries instead of ctime entries. 1m--one-file-system0m (c, r, and u modes) Do not cross mount points. 1m--options 4m22moptions0m Select optional behaviors for particular modules. The argument is a text string containing comma-separated keywords and val‐ ues. These are passed to the modules that handle particular formats to control how those formats will behave. Each option has one of the following forms: 4mkey=value0m The key will be set to the specified value in every module that supports it. Modules that do not support this key will ignore it. 4mkey24m The key will be enabled in every module that supports it. This is equivalent to 4mkey24m1m=122m. 4m!key24m The key will be disabled in every module that supports it. 4mmodule:key=value24m, 4mmodule:key24m, 4mmodule:!key0m As above, but the corresponding key and value will be provided only to modules whose name matches 4mmodule24m. The complete list of supported modules and keys for create and append modes is in 4marchive_write_set_options24m(3) and for extract and list modes in 4marchive_read_set_options24m(3). Examples of supported options: 1miso9660:joliet0m Support Joliet extensions. This is enabled by default, use 1m!joliet 22mor 1miso9660:!joliet 22mto disable. 1miso9660:rockridge0m Support Rock Ridge extensions. This is enabled by de‐ fault, use 1m!rockridge 22mor 1miso9660:!rockridge 22mto disable. 1mgzip:compression-level0m A decimal integer from 1 to 9 specifying the gzip com‐ pression level. 1mgzip:timestamp0m Store timestamp. This is enabled by default, use 1m!timestamp 22mor 1mgzip:!timestamp 22mto disable. 1mlrzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, ex‐ tremely slow). 1mlrzip:compression-level0m A decimal integer from 1 to 9 specifying the lrzip com‐ pression level. 1mlz4:compression-level0m A decimal integer from 1 to 9 specifying the lzop com‐ pression level. 1mlz4:stream-checksum0m Enable stream checksum. This is by default, use 1mlz4:!stream-checksum 22mto disable. 1mlz4:block-checksum0m Enable block checksum (Disabled by default). 1mlz4:block-size0m A decimal integer from 4 to 7 specifying the lz4 com‐ pression block size (7 is set by default). 1mlz4:block-dependence0m Use the previous block of the block being compressed for a compression dictionary to improve compression ra‐ tio. 1mzstd:compression-level22m=4mN0m A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. 1mzstd:threads22m=4mN0m Specify the number of worker threads to use, or 0 to use as many threads as there are CPU cores in the sys‐ tem. 1mzstd:frame-per-file0m Start a new compression frame at the beginning of each file in the archive. 1mzstd:min-frame-in22m=4mN0m In combination with 1mzstd:frame-per-file22m, do not start a new compression frame unless the uncompressed size of the current frame is at least 4mN24m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilobytes, megabytes or gigabytes respectively. 1mzstd:min-frame-out22m=4mN24m, 1mzstd:min-frame-size22m=4mN0m In combination with 1mzstd:frame-per-file22m, do not start a new compression frame unless the compressed size of the current frame is at least 4mN24m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilo‐ bytes, megabytes or gigabytes respectively. 1mzstd:max-frame-in22m=4mN24m, 1mzstd:max-frame-size22m=4mN0m Start a new compression frame as soon as possible after the uncompressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilobytes, megabytes or gigabytes respectively. Values less than 1,024 will be rejected. 1mzstd:max-frame-out22m=4mN0m Start a new compression frame as soon as possible after the compressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilobytes, megabytes or gigabytes respectively. Values less than 1,024 will be rejected. 1mlzop:compression-level0m A decimal integer from 1 to 9 specifying the lzop com‐ pression level. 1mxz:compression-level0m A decimal integer from 0 to 9 specifying the xz com‐ pression level. 1mxz:threads0m Specify the number of worker threads to use. Setting threads to a special value 0 makes 4mxz24m(1) use as many threads as there are CPU cores on the system. 1mmtree:4m22mkeyword0m The mtree writer module allows you to specify which mtree keywords will be included in the output. Sup‐ ported keywords include: 1mcksum22m, 1mdevice22m, 1mflags22m, 1mgid22m, 1mgname22m, 1mindent22m, 1mlink22m, 1mmd522m, 1mmode22m, 1mnlink22m, 1mrmd16022m, 1msha122m, 1msha25622m, 1msha38422m, 1msha51222m, 1msize22m, 1mtime22m, 1muid22m, 1muname22m. The default is equivalent to: “device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname”. 1mmtree:all0m Enables all of the above keywords. You can also use 1mmtree:!all 22mto disable all keywords. 1mmtree:use-set0m Enable generation of 1m/set 22mlines in the output. 1mmtree:indent0m Produce human-readable output by indenting options and splitting lines to fit into 80 columns. 1mzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are store (uncompressed) and deflate (gzip algorithm). 1mzip:encryption0m Enable encryption using traditional zip encryption. 1mzip:encryption22m=4mtype0m Use 4mtype24m as encryption type. Supported values are zipcrypt (traditional zip encryption), aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ tion). 1mread_concatenated_archives0m Ignore zeroed blocks in the archive, which occurs when multiple tar archives have been concatenated together. Without this option, only the contents of the first concatenated archive would be read. This option is comparable to the 1m-i22m, 1m--ignore-zeros 22moption of GNU tar. If a provided option is not supported by any module, that is a fatal error. 1m-P22m, 1m--absolute-paths0m Preserve pathnames. By default, absolute pathnames (those that begin with a / character) have the leading slash removed both when creating archives and extracting from them. Also, 1mtar0m will refuse to extract archive entries whose pathnames contain 4m..24m or whose target directory would be altered by a symlink. This option suppresses these behaviors. 1m-p22m, 1m--insecure22m, 1m--preserve-permissions0m (x mode only) Preserve file permissions. Attempt to restore the full permissions, including file modes, file attributes or file flags, extended file attributes and ACLs, if available, for each item extracted from the archive. This is the reverse of 1m--no-same-permissions 22mand the default if 1mtar 22mis being run as root. It can be partially overridden by also specifying 1m--no-acls22m, 1m--no-fflags22m, 1m--no-mac-metadata 22mor 1m--no-xattrs22m. 1m--passphrase 4m22mpassphrase0m The 4mpassphrase24m is used to extract or create an encrypted archive. Currently, zip is the only supported format that sup‐ ports encryption. You shouldn't use this option unless you re‐ alize how insecure use of this option is. 1m--posix0m (c, r, u mode only) Synonym for 1m--format 4m22mpax0m 1m-q22m, 1m--fast-read0m (x and t mode only) Extract or list only the first archive en‐ try that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by con‐ vention, later entries overwrite earlier entries. This option is provided as a performance optimization. 1m--read-sparse0m (c, r, u modes only) Read sparse file information from disk. This is the reverse of 1m--no-read-sparse 22mand the default behav‐ ior. 1m-S 22m(x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similar to the conv=sparse op‐ tion of dd. 1m-s 4m22mpattern0m Modify file or archive member names according to 4mpattern24m. The pattern has the format 4m/old/new/24m[bghHprRsS] where 4mold24m is a ba‐ sic regular expression, 4mnew24m is the replacement string of the matched part, and the optional trailing letters modify how the replacement is handled. If 4mold24m is not matched, the pattern is skipped. Within 4mnew24m, ~ is substituted with the match, \1 to \9 with the content of the corresponding captured group. The op‐ tional trailing g specifies that matching should continue after the matched part and stop on the first unmatched pattern. The optional trailing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies that after a successful substitution the original path name and the new path name should be printed to standard error. The op‐ tional trailing b specifies that the substitution should be matched from the beginning of the string rather than from right after the position at which the previous matching substitution ended. Optional trailing H, R, or S characters suppress sub‐ stitutions for hardlink targets, regular filenames, or symlink targets, respectively. Optional trailing h, r, or s characters enable substitutions for hardlink targets, regular filenames, or symlink targets, respectively. The default is 4mhrs24m which ap‐ plies substitutions to all names. In particular, it is never necessary to specify h, r, or s. 1m--safe-writes0m (x mode only) Extract files atomically. By default 1mtar 22munlinks the original file with the same name as the extracted file (if it exists), and then creates it immediately under the same name and writes to it. For a short period of time, applications trying to access the file might not find it, or see incomplete results. If 1m--safe-writes 22mis enabled, 1mtar 22mfirst creates a unique temporary file, then writes the new contents to the tem‐ porary file, and finally renames the temporary file to its fi‐ nal name atomically using 4mrename24m(2). This guarantees that an application accessing the file, will either see the old con‐ tents or the new contents at all times. 1m--same-owner0m (x mode only) Extract owner and group IDs. This is the reverse of 1m--no-same-owner 22mand the default behavior if 1mtar 22mis run as root. 1m--strip-components 4m22mcount0m Remove the specified number of leading path elements. Path‐ names with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion pat‐ terns but before security checks. 1m-T 4m22mfilename24m, 1m--files-from 4m22mfilename0m In x or t mode, 1mtar 22mwill read the list of names to be extracted from 4mfilename24m. In c mode, 1mtar 22mwill read names to be archived from 4mfilename24m. The special name “-C” on a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by new‐ lines unless 1m--null 22mis specified. Note that 1m--null 22malso dis‐ ables the special handling of lines containing “-C”. Note: If you are generating lists of files using 4mfind24m(1), you probably want to use 1m-n 22mas well. 1m--totals0m (c, r, u modes only) After archiving all files, print a summary to stderr. 1m-U22m, 1m--unlink22m, 1m--unlink-first0m (x mode only) Unlink files before creating them. This can be a minor performance optimization if most files already exist, but can make things slower if most files do not already exist. This flag also causes 1mtar 22mto remove intervening directory sym‐ links instead of reporting an error. See the “SECURITY” sec‐ tion below for more details. 1m--uid 4m22mid0m Use the provided user id number and ignore the user name from the archive. On create, if 1m--uname 22mis not also specified, the user name will be set to match the user id. 1m--uname 4m22mname0m Use the provided user name. On extract, this overrides the user name in the archive; if the provided user name does not exist on the system, it will be ignored and the user id (from the archive or from the 1m--uid 22moption) will be used instead. On create, this sets the user name that will be stored in the archive; the name is not verified against the system user data‐ base. 1m--use-compress-program 4m22mprogram0m Pipe the input (in x or t mode) or the output (in c mode) through 4mprogram24m instead of using the builtin compression sup‐ port. 1m--owner 4m22mname24m[:4muid24m] Use the provided user, if 4muid24m is not provided, 4mname24m can be ei‐ ther an username or numeric id. See the 1m--uname 22moption for de‐ tails. 1m-v22m, 1m--verbose0m Produce verbose output. In create and extract modes, 1mtar 22mwill list each file name as it is read from or written to the archive. In list mode, 1mtar 22mwill produce output similar to that of 4mls24m(1). An additional 1m-v 22moption will also provide ls-like details in create and extract mode. 1m--version0m Print version of 1mtar 22mand 1mlibarchive22m, and exit. 1m-w22m, 1m--confirmation22m, 1m--interactive0m Ask for confirmation for every action. 1m-X 4m22mfilename24m, 1m--exclude-from 4m22mfilename0m Read a list of exclusion patterns from the specified file. See 1m--exclude 22mfor more information about the handling of exclu‐ sions. 1m--xattrs0m (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of 1m--no-xattrs 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. 1m-y 22m(c mode only) Compress the resulting archive with 4mbzip224m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically when reading archives. 1m-Z22m, 1m--compress22m, 1m--uncompress0m (c mode only) Compress the resulting archive with 4mcompress24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes compress compression auto‐ matically when reading archives. 1m-z22m, 1m--gunzip22m, 1m--gzip0m (c mode only) Compress the resulting archive with 4mgzip24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes gzip compression automatically when reading archives. 1mENVIRONMENT0m The following environment variables affect the execution of 1mtar22m: TAR_READER_OPTIONS The default options for format readers and compression readers. The 1m--options 22moption overrides this. TAR_WRITER_OPTIONS The default options for format writers and compression writers. The 1m--options 22moption overrides this. LANG The locale to use. See 4menviron24m(7) for more information. TAPE The default device. The 1m-f 22moption overrides this. Please see the description of the 1m-f 22moption above for more details. TZ The timezone to use when displaying dates. See 4menviron24m(7) for more information. 1mEXIT STATUS0m The 1mtar 22mutility exits 0 on success, and >0 if an error occurs. 1mEXAMPLES0m The following creates a new archive called 4mfile.tar.gz24m that contains two files 4msource.c24m and 4msource.h24m: 1mtar -czf 4m22mfile.tar.gz24m 4msource.c24m 4msource.h0m To view a detailed table of contents for this archive: 1mtar -tvf 4m22mfile.tar.gz0m To extract all entries from the archive on the default tape drive: 1mtar -x0m To examine the contents of an ISO 9660 cdrom image: 1mtar -tf 4m22mimage.iso0m To move file hierarchies, invoke 1mtar 22mas 1mtar -cf 4m22m-24m 1m-C 4m22msrcdir24m 4m.24m | 1mtar -xpf 4m22m-24m 1m-C 4m22mdestdir0m or more traditionally 1mcd srcdir ; tar -cf 4m22m-24m 4m.24m | (4mcd24m 4mdestdir24m 4m;24m 1mtar -xpf 4m22m-24m) In create mode, the list of files and directories to be archived can also include directory change instructions of the form 1m-C4m22mfoo/baz24m and archive inclusions of the form 1m@@4m22marchive-file24m. For example, the command line 1mtar -c -f 4m22mnew.tar24m 4mfoo124m 1m@@4m22mold.tgz24m 1m-C4m22m/tmp24m 4mfoo20m will create a new archive 4mnew.tar24m. 1mtar 22mwill read the file 4mfoo124m from the current directory and add it to the output archive. It will then read each entry from 4mold.tgz24m and add those entries to the output archive. Finally, it will switch to the 4m/tmp24m directory and add 4mfoo224m to the output archive. An input file in 4mmtree24m(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ from existing data on disk: $ cat input.mtree #mtree usr/bin uid=0 gid=0 mode=0755 type=dir usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls $ tar -cvf output.tar @@input.mtree The 1m--newer 22mand 1m--newer-mtime 22mswitches accept a variety of common date and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12 19:14”, “5 minutes ago”, and “19:14 PST May 1”. The 1m--options 22margument can be used to control various details of archive generation or reading. For example, you can generate mtree output which only contains 1mtype22m, 1mtime22m, and 1muid 22mkeywords: 1mtar -cf 4m22mfile.tar24m 1m--format=mtree --options='!all,type,time,uid'0m 4mdir0m or you can set the compression level used by gzip or xz compression: 1mtar -czf 4m22mfile.tar24m 1m--options='compression-level=9'22m. For more details, see the explanation of the 1marchive_read_set_options22m() and 1marchive_write_set_options22m() API calls that are described in 4marchive_read24m(3) and 4marchive_write24m(3). 1mCOMPATIBILITY0m The bundled-arguments format is supported for compatibility with his‐ toric implementations. It consists of an initial word (with no leading - character) in which each character indicates an option. Arguments follow as separate words. The order of the arguments must match the order of the corresponding characters in the bundled command word. For example, 1mtar tbf 32 4m22mfile.tar0m specifies three flags 1mt22m, 1mb22m, and 1mf22m. The 1mb 22mand 1mf 22mflags both require ar‐ guments, so there must be two additional items on the command line. The 4m3224m is the argument to the 1mb 22mflag, and 4mfile.tar24m is the argument to the 1mf 22mflag. The mode options c, r, t, u, and x and the options b, f, l, m, o, v, and w comply with SUSv2. For maximum portability, scripts that invoke 1mtar 22mshould use the bun‐ dled-argument format above, should limit themselves to the 1mc22m, 1mt22m, and 1mx0m modes, and the 1mb22m, 1mf22m, 1mm22m, 1mv22m, and 1mw 22moptions. Additional long options are provided to improve compatibility with other tar implementations. 1mSECURITY0m Certain security issues are common to many archiving programs, includ‐ ing 1mtar22m. In particular, carefully-crafted archives can request that 1mtar 22mextract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files they did not intend to overwrite. If the archive is being extracted by the superuser, any file on the system can potentially be overwritten. There are three ways this can happen. Although 1mtar 22mhas mechanisms to protect against each one, savvy users should be aware of the implica‐ tions: 1m• 22mArchive entries can have absolute pathnames. By default, 1mtar0m removes the leading 4m/24m character from filenames before restoring them to guard against this problem. 1m• 22mArchive entries can have pathnames that include 4m..24m components. By default, 1mtar 22mwill not extract files containing 4m..24m components in their pathname. 1m• 22mArchive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that directory. To guard against this, 1mtar 22mchecks each ex‐ tracted path for symlinks. If the final path element is a sym‐ link, it will be removed and replaced with the archive entry. If 1m-U 22mis specified, any intermediate symlink will also be un‐ conditionally removed. If neither 1m-U 22mnor 1m-P 22mis specified, 1mtar0m will refuse to extract the entry. To protect yourself, you should be wary of any archives that come from untrusted sources. You should examine the contents of an archive with 1mtar -tf 4m22mfilename0m before extraction. You should use the 1m-k 22moption to ensure that 1mtar0m will not overwrite any existing files or the 1m-U 22moption to remove any pre-existing files. You should generally not extract archives while running with super-user privileges. Note that the 1m-P 22moption to 1mtar0m disables the security checks above and allows you to extract an archive while preserving any absolute pathnames, 4m..24m components, or symlinks to other directories. 1mSEE ALSO0m 4mbzip224m(1), 4mcompress24m(1), 4mcpio24m(1), 4mgzip24m(1), 4mmt24m(1), 4mpax24m(1), 4mshar24m(1), 4mxz24m(1), 4mlibarchive24m(3), 4mlibarchive-formats24m(5), 4mtar24m(5) 1mSTANDARDS0m There is no current POSIX standard for the tar command; it appeared in ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX spec‐ ification for pax. The ustar and pax interchange file formats are defined by IEEE Std 1003.1-2001 (“POSIX.1”) for the pax command. 1mHISTORY0m A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in January, 1979. There have been numerous other implementations, many of which extended the file format. John Gilmore's 1mpdtar 22mpublic-domain im‐ plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in FreeBSD beginning with FreeBSD 1.0. This is a complete re-implementation based on the 4mlibarchive24m(3) li‐ brary. It was first released with FreeBSD 5.4 in May, 2005. 1mBUGS0m This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition of the 1m-l 22moption. Note that GNU tar prior to version 1.15 treated 1m-l0m as a synonym for the 1m--one-file-system 22moption. The 1m-C 4m22mdir24m option may differ from historic implementations. All archive output is written in correctly-sized blocks, even if the output is being compressed. Whether or not the last output block is padded to a full block size varies depending on the format and the out‐ put device. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many compressors, including 4mgzip24m(1) and 4mbzip224m(1), complain about the null padding when decompressing an archive created by 1mtar22m, although they still extract it correctly. The compression and decompression is implemented internally, so there may be insignificant differences between the compressed output gener‐ ated by 1mtar -czf 4m22m-24m 4mfile0m and that generated by 1mtar -cf 4m22m-24m 4mfile24m | 1mgzip0m The default should be to read and write archives to the standard I/O paths, but tradition (and POSIX) dictates otherwise. The 1mr 22mand 1mu 22mmodes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using 1mc 22mmode with the 4m@@archive-file24m extension. To archive a file called 4m@@foo24m or 4m-foo24m you must specify it as 4m./@@foo24m or 4m./-foo24m, respectively. In create mode, a leading 4m./24m is always removed. A leading 4m/24m is stripped unless the 1m-P 22moption is specified. There needs to be better support for file selection on both create and extract. There is not yet any support for multi-volume archives. Converting between dissimilar archive formats (such as tar and cpio) using the 1m@@4m22m-24m convention can cause hard link information to be lost. This is a consequence of the incompatible ways that different archive formats store hardlink information. Debian April 23, 2024 4mTAR24m(1) @ 1.13 log @bsdtar libarchive: updated to 3.7.9 3.7.9 Important bugfixes: a regression in libarchive 3.7.8 regarding GNU sparse entries was fixed 3.7.8 Security fixes: tar reader: Handle truncation in the middle of a GNU long linkname unzip: fix null pointer dereference tar reader: fix unchecked return value in list_item_verbose() Important bugfixes: 7zip reader: add SPARC tar reader: Ignore ustar size when pax size is present tar writer: Fix bug when -s/a/b/ used more than once with b flag cpio: Fix a Y2038 bug on Windows libarchive: Handle ARCHIVE_FILTER_LZOP in archive_read_append_filter libarchive: Adding missing seeker function to archive_read_open_FILE() @ text @d130 4 d135 2 a136 2 (x mode only) Before removing file system objects to replace them, clear platform-specific file attributes or file flags d140 1 a140 1 Do not process files or directories that match the specified d146 1 a146 1 sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’, d150 1 a150 1 (c, r, u, x modes only) Archive or extract platform-specific d156 3 a158 3 (c, r, u mode only) Use the specified format for the created archive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see d160 2 a161 2 ported formats. In r and u modes, when extending an existing archive, the format specified here must be compatible with the d165 3 a167 3 Read the archive from or write the archive to the specified file. The filename can be 4m-24m for standard input or standard output. The default varies by system; on FreeBSD, the default d171 1 a171 1 Use the provided group id number. On extract, this overrides d173 2 a174 2 be ignored. On create, this overrides the group id read from disk; if 1m--gname 22mis not also specified, the group name will be d178 2 a179 2 Use the provided group name. On extract, this overrides the group name in the archive; if the provided group name does not d181 2 a182 2 1m--gid 22moption) will be used instead. On create, this sets the group name that will be stored in the archive; the name will d187 1 a187 1 ther a group name or numeric id. See the 1m--gname 22moption for d190 2 a191 2 1m-H 22m(c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not d201 1 a201 1 (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ d205 1 a205 1 An alias of 1m--options read_concatenated_archives 22mfor compati‐ d210 2 a211 2 tern. Note that exclusions specified with 1m--exclude 22mtake precedence over inclusions. If no inclusions are explicitly d218 1 a218 1 creates a new archive 4mnew.tar24m containing only the entries from d222 2 a223 2 (c mode only) Compress the resulting archive with 4mxz24m(1). In extract or list modes, this option is ignored. Note that this d229 2 a230 2 extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically d234 2 a235 2 (x mode only) Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies d239 1 a239 1 (x mode only) Do not overwrite existing files that are newer d244 1 a244 1 mally, symbolic links are archived as such. With this option, d248 1 a248 1 (c and r modes only) Issue a warning message unless all links d253 2 a254 2 extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lrzip compression automatically d258 2 a259 2 sion before writing it. In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lz4 d262 1 a262 1 1m--zstd 22m(c mode only) Compress the archive with zstd-compatible com‐ d264 1 a264 1 tion is ignored. Note that this 1mtar 22mimplementation recognizes d267 3 a269 3 1m--lzma 22m(c mode only) Compress the resulting archive with the original LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives d271 1 a271 1 mentation recognizes LZMA compression automatically when read‐ d274 3 a276 3 1m--lzop 22m(c mode only) Compress the resulting archive with 4mlzop24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes LZO compression automatically d280 1 a280 1 (x mode only) Do not extract modification time. By default, d284 5 a288 5 (c, r, u and x mode only) Mac OS X specific. Archive or ex‐ tract extended ACLs and extended file attributes using 4mcopyfile24m(3) in AppleDouble format. This is the reverse of 1m--no-mac-metadata22m. and the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. Currently supported d292 4 d341 4 a344 4 (x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using 4mcopyfile24m(3) in Apple‐ Double format. This is the reverse of 1m--mac-metadata22m. and the default behavior if 1mtar 22mis run as non-root in x mode. @ 1.12 log @libarchive: updated to 3.7.7 Libarchive 3.7.7 is a bugfix and security release Security fixes: gzip: prevent a hang when processing a malformed gzip inside a gzip tar: don't crash on truncated tar archives tar: fix two leaks in tar header parsing Important bugfixes: 7-zip: read/write symlink paths as UTF-8 cpio: exit with an error code if an entry could not be extracted rar5: report encrypted entries tar: fix truncation of entry pathnames in specific archives windows: fix ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS Libarchive 3.7.6 is a bugfix and security release. This release fixes a tar regression introduced in libarchive 3.7.5 Important bugfixes. tar: clean up linkpath between entries tar: fix memory leaks when processing symlinks or parsing pax headers iso: be more cautious about parsing ISO-9660 timestamps @ text @d14 3 a16 3 tion can extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives. d19 2 a20 2 provided for compatibility with historical implementations. See COM‐ PATIBILITY below for details. d24 1 d60 1 d62 1 d65 1 d67 1 d69 1 d71 1 d80 1 d82 1 d85 1 d87 1 d90 1 d92 1 d94 1 d96 1 d99 1 d101 1 d211 1 d213 1 d285 2 a286 2 only for pax formats (including "pax restricted", the default tar format for bsdtar.) d292 1 a292 1 (c, r, u modes only) Only include files and directories newer d300 1 a300 1 (c, r, u modes only) Only include files and directories newer d304 1 a304 1 (c, r, u modes only) Like 1m--newer-than22m, except it compares d308 1 a308 1 (c and r modes only) Honor the nodump file flag by skipping d312 3 a314 3 (x mode only) Mac OS X specific (v10.6 or later). Do not com‐ press extracted regular files which were compressed with HFS+ compression before archived. By default, compress the regular d318 1 a318 1 characters, not by newlines. This is often used to read file‐ d322 3 a324 3 (c, r, u, x modes only) Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--acls 22mand the default be‐ havior if 1mtar 22mis run as non-root in x mode (on Mac OS X as any d328 2 a329 2 (c, r, u, x modes only) Do not archive or extract file attrib‐ utes or file flags. This is the reverse of 1m--fflags 22mand the d333 2 a334 2 (x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using 4mcopyfile24m(3) in Apple‐ d339 1 a339 1 (c, r, u modes only) Do not read sparse file information from d343 2 a344 2 (x mode only) Do not create temporary files and use 4mrename24m(2) to replace the original ones. This is the reverse of d348 2 a349 2 (x mode only) Do not extract owner and group IDs. This is the reverse of 1m--same-owner 22mand the default behavior if 1mtar 22mis run d353 3 a355 3 (x mode only) Do not extract full permissions (SGID, SUID, sticky bit, file attributes or file flags, extended file at‐ tributes and ACLs). This is the reverse of 1m-p 22mand the default d360 1 a360 1 attributes. This is the reverse of 1m--xattrs 22mand the default d364 1 a364 1 This is equivalent to 1m--uname 22m"" 1m--gname 22m"". On extract, it d366 1 a366 1 vor of the numeric user and group ids. On create, it causes d370 3 a372 3 (x, t modes only) In extract (-x) mode, files will be written to standard out rather than being extracted to disk. In list (-t) mode, the file listing will be written to stderr rather d377 3 a379 3 no significance unless 1m-p 22mis specified, and the program is be‐ ing run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner in‐ d385 1 a385 1 (c, r, u modes only) Only include files and directories older d393 1 a393 1 (c, r, u modes only) Only include files and directories older d397 1 a397 1 (c, r, u modes only) Like 1m--older-than22m, except it compares d405 3 a407 3 is a text string containing comma-separated keywords and val‐ ues. These are passed to the modules that handle particular formats to control how those formats will behave. Each option d409 1 d411 2 a412 2 The key will be set to the specified value in every module that supports it. Modules that do not support d414 1 a414 1 4mkey24m The key will be enabled in every module that supports d416 1 a416 1 4m!key24m The key will be disabled in every module that supports d419 1 a419 1 As above, but the corresponding key and value will be d422 1 a422 1 The complete list of supported modules and keys for create and d427 1 d432 1 a432 1 Support Rock Ridge extensions. This is enabled by de‐ d435 1 a435 1 A decimal integer from 1 to 9 specifying the gzip com‐ d438 1 a438 1 Store timestamp. This is enabled by default, use d441 2 a442 2 Use 4mtype24m as compression method. Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, ex‐ d448 1 a448 1 A decimal integer from 1 to 9 specifying the lzop com‐ d456 1 a456 1 A decimal integer from 4 to 7 specifying the lz4 com‐ d459 1 a459 1 Use the previous block of the block being compressed d467 2 a468 2 Specify the number of worker threads to use, or 0 to use as many threads as there are CPU cores in the sys‐ d471 1 a471 1 Start a new compression frame at the beginning of each d475 3 a477 3 new compression frame unless the uncompressed size of the current frame is at least 4mN24m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate d482 1 a482 1 current frame is at least 4mN24m bytes. The number may be d487 2 a488 2 the uncompressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, d493 2 a494 2 the compressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, d498 1 a498 1 A decimal integer from 1 to 9 specifying the lzop com‐ d501 1 a501 1 A decimal integer from 0 to 9 specifying the xz com‐ d504 2 a505 2 Specify the number of worker threads to use. Setting threads to a special value 0 makes 4mxz24m(1) use as many d508 6 a513 6 The mtree writer module allows you to specify which mtree keywords will be included in the output. Sup‐ ported keywords include: 1mcksum22m, 1mdevice22m, 1mflags22m, 1mgid22m, 1mgname22m, 1mindent22m, 1mlink22m, 1mmd522m, 1mmode22m, 1mnlink22m, 1mrmd16022m, 1msha122m, 1msha25622m, 1msha38422m, 1msha51222m, 1msize22m, 1mtime22m, 1muid22m, 1muname22m. The default is equivalent to: “device, flags, gid, gname, d516 1 a516 1 Enables all of the above keywords. You can also use d521 1 a521 1 Produce human-readable output by indenting options and d524 1 a524 1 Use 4mtype24m as compression method. Supported values are d529 3 a531 3 Use 4mtype24m as encryption type. Supported values are zipcrypt (traditional zip encryption), aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ d534 4 a537 4 Ignore zeroed blocks in the archive, which occurs when multiple tar archives have been concatenated together. Without this option, only the contents of the first concatenated archive would be read. This option is d539 2 a540 1 If a provided option is not supported by any module, that is a d545 4 a548 4 begin with a / character) have the leading slash removed both when creating archives and extracting from them. Also, 1mtar0m will refuse to extract archive entries whose pathnames contain 4m..24m or whose target directory would be altered by a symlink. d552 4 a555 4 (x mode only) Preserve file permissions. Attempt to restore the full permissions, including file modes, file attributes or file flags, extended file attributes and ACLs, if available, for each item extracted from the archive. This is the reverse d557 1 a557 1 root. It can be partially overridden by also specifying d561 1 a561 1 The 4mpassphrase24m is used to extract or create an encrypted d570 6 a575 6 (x and t mode only) Extract or list only the first archive en‐ try that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by con‐ vention, later entries overwrite earlier entries. This option d579 2 a580 2 (c, r, u modes only) Read sparse file information from disk. This is the reverse of 1m--no-read-sparse 22mand the default behav‐ d583 3 a585 3 1m-S 22m(x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similar to the conv=sparse op‐ d589 5 a593 5 Modify file or archive member names according to 4mpattern24m. The pattern has the format 4m/old/new/24m[bghHprRsS] where 4mold24m is a ba‐ sic regular expression, 4mnew24m is the replacement string of the matched part, and the optional trailing letters modify how the replacement is handled. If 4mold24m is not matched, the pattern is d595 1 a595 1 with the content of the corresponding captured group. The op‐ d597 3 a599 3 the matched part and stop on the first unmatched pattern. The optional trailing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies d602 1 a602 1 tional trailing b specifies that the substitution should be d604 3 a606 3 after the position at which the previous matching substitution ended. Optional trailing H, R, or S characters suppress sub‐ stitutions for hardlink targets, regular filenames, or symlink d608 1 a608 1 enable substitutions for hardlink targets, regular filenames, d610 1 a610 1 plies substitutions to all names. In particular, it is never d615 1 a615 1 the original file with the same name as the extracted file (if d617 3 a619 3 and writes to it. For a short period of time, applications trying to access the file might not find it, or see incomplete results. If 1m--safe-writes 22mis enabled, 1mtar 22mfirst creates a d621 3 a623 3 porary file, and finally renames the temporary file to its fi‐ nal name atomically using 4mrename24m(2). This guarantees that an application accessing the file, will either see the old con‐ d628 1 a628 1 of 1m--no-same-owner 22mand the default behavior if 1mtar 22mis run as d632 3 a634 3 Remove the specified number of leading path elements. Path‐ names with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion pat‐ d639 5 a643 5 from 4mfilename24m. In c mode, 1mtar 22mwill read names to be archived from 4mfilename24m. The special name “-C” on a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by new‐ lines unless 1m--null 22mis specified. Note that 1m--null 22malso dis‐ d645 1 a645 1 you are generating lists of files using 4mfind24m(1), you probably d655 4 a658 4 can make things slower if most files do not already exist. This flag also causes 1mtar 22mto remove intervening directory sym‐ links instead of reporting an error. See the SECURITY section below for more details. d661 2 a662 2 Use the provided user id number and ignore the user name from the archive. On create, if 1m--uname 22mis not also specified, the d666 3 a668 3 Use the provided user name. On extract, this overrides the user name in the archive; if the provided user name does not exist on the system, it will be ignored and the user id (from d670 1 a670 1 create, this sets the user name that will be stored in the d675 2 a676 2 Pipe the input (in x or t mode) or the output (in c mode) through 4mprogram24m instead of using the builtin compression sup‐ d680 1 a680 1 Use the provided user, if 4muid24m is not provided, 4mname24m can be ei‐ d685 2 a686 2 Produce verbose output. In create and extract modes, 1mtar 22mwill list each file name as it is read from or written to the d688 1 a688 1 of 4mls24m(1). An additional 1m-v 22moption will also provide ls-like d699 1 a699 1 1m--exclude 22mfor more information about the handling of exclu‐ d703 3 a705 3 (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of 1m--no-xattrs 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as d709 2 a710 2 extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically d714 3 a716 3 (c mode only) Compress the resulting archive with 4mcompress24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes compress compression auto‐ d720 3 a722 3 (c mode only) Compress the resulting archive with 4mgzip24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes gzip compression automatically d738 1 a738 1 TAPE The default device. The 1m-f 22moption overrides this. Please see d741 1 a741 1 TZ The timezone to use when displaying dates. See 4menviron24m(7) for d748 1 a748 1 The following creates a new archive called 4mfile.tar.gz24m that contains d750 1 d754 1 d758 1 d762 1 d766 1 d768 1 d770 1 d773 2 a774 2 In create mode, the list of files and directories to be archived can also include directory change instructions of the form 1m-C4m22mfoo/baz24m and d777 1 d779 4 a782 3 will create a new archive 4mnew.tar24m. 1mtar 22mwill read the file 4mfoo124m from the current directory and add it to the output archive. It will then read each entry from 4mold.tgz24m and add those entries to the output d786 2 a787 2 An input file in 4mmtree24m(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ d796 1 a796 1 The 1m--newer 22mand 1m--newer-mtime 22mswitches accept a variety of common date d800 2 a801 2 The 1m--options 22margument can be used to control various details of archive generation or reading. For example, you can generate mtree d803 2 a804 1 1mtar -cf 4m22mfile.tar24m 1m--format=mtree --options='!all,type,time,uid'0m d806 1 d808 1 d810 1 d812 1 a812 1 and 1marchive_write_set_options22m() API calls that are described in d816 1 a816 1 The bundled-arguments format is supported for compatibility with his‐ d818 2 a819 2 - character) in which each character indicates an option. Arguments follow as separate words. The order of the arguments must match the d822 1 d824 4 a827 3 specifies three flags 1mt22m, 1mb22m, and 1mf22m. The 1mb 22mand 1mf 22mflags both require ar‐ guments, so there must be two additional items on the command line. The 4m3224m is the argument to the 1mb 22mflag, and 4mfile.tar24m is the argument to d830 1 a830 1 The mode options c, r, t, u, and x and the options b, f, l, m, o, v, d833 2 a834 2 For maximum portability, scripts that invoke 1mtar 22mshould use the bun‐ dled-argument format above, should limit themselves to the 1mc22m, 1mt22m, and 1mx0m d837 1 a837 1 Additional long options are provided to improve compatibility with d841 4 a844 4 Certain security issues are common to many archiving programs, includ‐ ing 1mtar22m. In particular, carefully-crafted archives can request that 1mtar 22mextract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files d846 3 a848 3 the superuser, any file on the system can potentially be overwritten. There are three ways this can happen. Although 1mtar 22mhas mechanisms to protect against each one, savvy users should be aware of the implica‐ d851 1 a851 1 1m• 22mArchive entries can have absolute pathnames. By default, 1mtar0m d855 1 a855 1 1m• 22mArchive entries can have pathnames that include 4m..24m components. d859 4 a862 4 1m• 22mArchive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that directory. To guard against this, 1mtar 22mchecks each ex‐ d864 3 a866 3 link, it will be removed and replaced with the archive entry. If 1m-U 22mis specified, any intermediate symlink will also be un‐ conditionally removed. If neither 1m-U 22mnor 1m-P 22mis specified, 1mtar0m d868 2 a869 1 To protect yourself, you should be wary of any archives that come from d871 1 d873 5 a877 4 before extraction. You should use the 1m-k 22moption to ensure that 1mtar0m will not overwrite any existing files or the 1m-U 22moption to remove any pre-existing files. You should generally not extract archives while running with super-user privileges. Note that the 1m-P 22moption to 1mtar0m d879 1 a879 1 while preserving any absolute pathnames, 4m..24m components, or symlinks to d887 3 a889 3 There is no current POSIX standard for the tar command; it appeared in ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation d894 1 a894 1 The ustar and pax interchange file formats are defined by IEEE Std d898 1 a898 1 A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in d901 2 a902 2 plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar d905 1 a905 1 This is a complete re-implementation based on the 4mlibarchive24m(3) li‐ d910 1 a910 1 of the 1m-l 22moption. Note that GNU tar prior to version 1.15 treated 1m-l0m d915 2 a916 2 All archive output is written in correctly-sized blocks, even if the output is being compressed. Whether or not the last output block is d918 6 a923 6 put device. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many compressors, including 4mgzip24m(1) and 4mbzip224m(1), complain about the null padding when decompressing an archive created by 1mtar22m, d926 2 a927 2 The compression and decompression is implemented internally, so there may be insignificant differences between the compressed output gener‐ d929 1 d931 1 d933 1 d936 1 a936 1 The default should be to read and write archives to the standard I/O d939 1 a939 1 The 1mr 22mand 1mu 22mmodes require that the archive be uncompressed and located d943 1 a943 1 To archive a file called 4m@@foo24m or 4m-foo24m you must specify it as 4m./@@foo24m or d946 1 a946 1 In create mode, a leading 4m./24m is always removed. A leading 4m/24m is d949 1 a949 1 There needs to be better support for file selection on both create and d954 4 a957 4 Converting between dissimilar archive formats (such as tar and cpio) using the 1m@@4m22m-24m convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) @ 1.11 log @libarchive: updated to 3.7.4 Libarchive 3.7.4 is a bugfix and security release Security fixes: rar: Fix OOB in rar e8 filter (CVE-2024-26256) zip: Fix out of boundary access Important bugfixes: 7zip: Limit amount of properties bsdtar: Fix error handling around strtol() usages passphrase: Improve newline handling on Windows passphrase: Never allow empty passwords rar: Fix "File CRC Error" when extracting specific rar4 archives xar: Avoid infinite link loop zip: Update AppleDouble support for directories zstd: Implement core detection @ text @d1 1 a1 1 TAR(1) BSD General Commands Manual TAR(1) d3 2 a4 2 NAME tar — manipulate tape archives d6 909 a914 889 SYNOPSIS tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...] tar {-c} [options] [files | directories] tar {-r | -u} -f archive-file [options] [files | directories] tar {-t | -x} [options] [patterns] DESCRIPTION tar creates and manipulates streaming archive files. This implementation can extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives. The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See COMPATI‐ BILITY below for details. The other synopsis forms show the preferred usage. The first option to tar is a mode indicator from the following list: -c Create a new archive containing the specified items. The long option form is --create. -r Like -c, but new entries are appended to the archive. Note that this only works on uncompressed archives stored in regular files. The -f option is required. The long option form is --append. -t List archive contents to stdout. The long option form is --list. -u Like -r, but new entries are added only if they have a modifica‐ tion date newer than the corresponding entry in the archive. Note that this only works on uncompressed archives stored in reg‐ ular files. The -f option is required. The long form is --update. -x Extract to disk from the archive. If a file with the same name appears more than once in the archive, each copy will be ex‐ tracted, with later copies overwriting (replacing) earlier copies. The long option form is --extract. In -c, -r, or -u mode, each specified file or directory is added to the archive in the order specified on the command line. By default, the con‐ tents of each directory are also archived. In extract or list mode, the entire command line is read and parsed be‐ fore the archive is opened. The pathnames or patterns on the command line indicate which items in the archive should be processed. Patterns are shell-style globbing patterns as documented in tcsh(1). OPTIONS Unless specifically stated otherwise, options are applicable in all oper‐ ating modes. @@archive (c and r modes only) The specified archive is opened and the en‐ tries in it will be appended to the current archive. As a simple example, tar -c -f - newfile @@original.tar writes a new archive to standard output containing a file newfile and all of the entries from original.tar. In contrast, tar -c -f - newfile original.tar creates a new archive with only two entries. Similarly, tar -czf - --format pax @@- reads an archive from standard input (whose format will be deter‐ mined automatically) and converts it into a gzip-compressed pax- format archive on stdout. In this way, tar can be used to con‐ vert archives from one format to another. -a, --auto-compress (c mode only) Use the archive suffix to decide a set of the for‐ mat and the compressions. As a simple example, tar -a -cf archive.tgz source.c source.h creates a new archive with restricted pax format and gzip com‐ pression, tar -a -cf archive.tar.bz2.uu source.c source.h creates a new archive with restricted pax format and bzip2 com‐ pression and uuencode compression, tar -a -cf archive.zip source.c source.h creates a new archive with zip format, tar -a -jcf archive.tgz source.c source.h ignores the “-j” option, and creates a new archive with re‐ stricted pax format and gzip compression, tar -a -jcf archive.xxx source.c source.h if it is unknown suffix or no suffix, creates a new archive with restricted pax format and bzip2 compression. --acls (c, r, u, x modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of --no-acls and the default behavior in c, r, and u modes (except on Mac OS X) or if tar is run in x mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the --mac-metadata option is preferred. -B, --read-full-blocks Ignored for compatibility with other tar(1) implementations. -b blocksize, --block-size blocksize Specify the block size, in 512-byte records, for tape drive I/O. As a rule, this argument is only needed when reading from or writing to tape drives, and usually not even then as the default block size of 20 records (10240 bytes) is very common. -C directory, --cd directory, --directory directory In c and r mode, this changes the directory before adding the following files. In x mode, change directories after opening the archive but before extracting entries from the archive. --chroot (x mode only) chroot() to the current directory after processing any -C options and before extracting any files. --clear-nochange-fflags (x mode only) Before removing file system objects to replace them, clear platform-specific file attributes or file flags that might prevent removal. --exclude pattern Do not process files or directories that match the specified pat‐ tern. Note that exclusions take precedence over patterns or filenames specified on the command line. --exclude-vcs Do not process files or directories internally used by the ver‐ sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’, ‘Mercurial’, ‘RCS’, ‘SCCS’, ‘SVN’ and ‘git’. --fflags (c, r, u, x modes only) Archive or extract platform-specific file attributes or file flags. This is the reverse of --no-fflags and the default behavior in c, r, and u modes or if tar is run in x mode as root. --format format (c, r, u mode only) Use the specified format for the created ar‐ chive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see libarchive-formats(5) for more information about currently-sup‐ ported formats. In r and u modes, when extending an existing ar‐ chive, the format specified here must be compatible with the for‐ mat of the existing archive on disk. -f file, --file file Read the archive from or write the archive to the specified file. The filename can be - for standard input or standard output. The default varies by system; on FreeBSD, the default is /dev/sa0; on Linux, the default is /dev/st0. --gid id Use the provided group id number. On extract, this overrides the group id in the archive; the group name in the archive will be ignored. On create, this overrides the group id read from disk; if --gname is not also specified, the group name will be set to match the group id. --gname name Use the provided group name. On extract, this overrides the group name in the archive; if the provided group name does not exist on the system, the group id (from the archive or from the --gid option) will be used instead. On create, this sets the group name that will be stored in the archive; the name will not be verified against the system group database. --group name[:gid] Use the provided group, if gid is not provided, name can be ei‐ ther a group name or numeric id. See the --gname option for de‐ tails. -H (c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not the link itself. -h (c and r modes only) Synonym for -L. -I Synonym for -T. --help Show usage. --hfsCompression (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ tracted regular files with HFS+ compression. --ignore-zeros An alias of --options read_concatenated_archives for compatibil‐ ity with GNU tar. --include pattern Process only files or directories that match the specified pat‐ tern. Note that exclusions specified with --exclude take prece‐ dence over inclusions. If no inclusions are explicitly speci‐ fied, all entries are processed by default. The --include option is especially useful when filtering archives. For example, the command tar -c -f new.tar --include='*foo*' @@old.tgz creates a new archive new.tar containing only the entries from old.tgz containing the string ‘foo’. -J, --xz (c mode only) Compress the resulting archive with xz(1). In ex‐ tract or list modes, this option is ignored. Note that this tar implementation recognizes XZ compression automatically when read‐ ing archives. -j, --bzip, --bzip2, --bunzip2 (c mode only) Compress the resulting archive with bzip2(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes bzip2 compression automatically when reading archives. -k, --keep-old-files (x mode only) Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies. --keep-newer-files (x mode only) Do not overwrite existing files that are newer than the versions appearing in the archive being extracted. -L, --dereference (c and r modes only) All symbolic links will be followed. Nor‐ mally, symbolic links are archived as such. With this option, the target of the link will be archived instead. -l, --check-links (c and r modes only) Issue a warning message unless all links to each file are archived. --lrzip (c mode only) Compress the resulting archive with lrzip(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes lrzip compression automatically when reading archives. --lz4 (c mode only) Compress the archive with lz4-compatible compres‐ sion before writing it. In extract or list modes, this option is ignored. Note that this tar implementation recognizes lz4 com‐ pression automatically when reading archives. --zstd (c mode only) Compress the archive with zstd-compatible compres‐ sion before writing it. In extract or list modes, this option is ignored. Note that this tar implementation recognizes zstd com‐ pression automatically when reading archives. --lzma (c mode only) Compress the resulting archive with the original LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives should be created with --xz instead. Note that this tar implementation recognizes LZMA compression automatically when reading archives. --lzop (c mode only) Compress the resulting archive with lzop(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes LZO compression automatically when reading archives. -m, --modification-time (x mode only) Do not extract modification time. By default, the modification time is set to the time stored in the archive. --mac-metadata (c, r, u and x mode only) Mac OS X specific. Archive or extract extended ACLs and extended file attributes using copyfile(3) in AppleDouble format. This is the reverse of --no-mac-metadata. and the default behavior in c, r, and u modes or if tar is run in x mode as root. Currently supported only for pax formats (in‐ cluding "pax restricted", the default tar format for bsdtar.) -n, --norecurse, --no-recursion Do not operate recursively on the content of directories. --newer date (c, r, u modes only) Only include files and directories newer than the specified date. This compares ctime entries. --newer-mtime date (c, r, u modes only) Like --newer, except it compares mtime en‐ tries instead of ctime entries. --newer-than file (c, r, u modes only) Only include files and directories newer than the specified file. This compares ctime entries. --newer-mtime-than file (c, r, u modes only) Like --newer-than, except it compares mtime entries instead of ctime entries. --nodump (c and r modes only) Honor the nodump file flag by skipping this file. --nopreserveHFSCompression (x mode only) Mac OS X specific (v10.6 or later). Do not compress extracted regular files which were compressed with HFS+ compres‐ sion before archived. By default, compress the regular files again with HFS+ compression. --null (use with -I or -T) Filenames or patterns are separated by null characters, not by newlines. This is often used to read file‐ names output by the -print0 option to find(1). --no-acls (c, r, u, x modes only) Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of --acls and the default behav‐ ior if tar is run as non-root in x mode (on Mac OS X as any user in c, r, u and x modes). --no-fflags (c, r, u, x modes only) Do not archive or extract file attributes or file flags. This is the reverse of --fflags and the default behavior if tar is run as non-root in x mode. --no-mac-metadata (x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using copyfile(3) in AppleDouble format. This is the reverse of --mac-metadata. and the default behavior if tar is run as non-root in x mode. --no-read-sparse (c, r, u modes only) Do not read sparse file information from disk. This is the reverse of --read-sparse. --no-safe-writes (x mode only) Do not create temporary files and use rename(2) to replace the original ones. This is the reverse of --safe-writes. --no-same-owner (x mode only) Do not extract owner and group IDs. This is the reverse of --same-owner and the default behavior if tar is run as non-root. --no-same-permissions (x mode only) Do not extract full permissions (SGID, SUID, sticky bit, file attributes or file flags, extended file attributes and ACLs). This is the reverse of -p and the default behavior if tar is run as non-root. --no-xattrs (c, r, u, x modes only) Do not archive or extract extended file attributes. This is the reverse of --xattrs and the default be‐ havior if tar is run as non-root in x mode. --numeric-owner This is equivalent to --uname "" --gname "". On extract, it causes user and group names in the archive to be ignored in favor of the numeric user and group ids. On create, it causes user and group names to not be stored in the archive. -O, --to-stdout (x, t modes only) In extract (-x) mode, files will be written to standard out rather than being extracted to disk. In list (-t) mode, the file listing will be written to stderr rather than the usual stdout. -o (x mode) Use the user and group of the user running the program rather than those specified in the archive. Note that this has no significance unless -p is specified, and the program is being run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner information in the archive will be discarded. -o (c, r, u mode) A synonym for --format ustar --older date (c, r, u modes only) Only include files and directories older than the specified date. This compares ctime entries. --older-mtime date (c, r, u modes only) Like --older, except it compares mtime en‐ tries instead of ctime entries. --older-than file (c, r, u modes only) Only include files and directories older than the specified file. This compares ctime entries. --older-mtime-than file (c, r, u modes only) Like --older-than, except it compares mtime entries instead of ctime entries. --one-file-system (c, r, and u modes) Do not cross mount points. --options options Select optional behaviors for particular modules. The argument is a text string containing comma-separated keywords and values. These are passed to the modules that handle particular formats to control how those formats will behave. Each option has one of the following forms: key=value The key will be set to the specified value in every mod‐ ule that supports it. Modules that do not support this key will ignore it. key The key will be enabled in every module that supports it. This is equivalent to key=1. !key The key will be disabled in every module that supports it. module:key=value, module:key, module:!key As above, but the corresponding key and value will be provided only to modules whose name matches module. The complete list of supported modules and keys for create and append modes is in archive_write_set_options(3) and for extract and list modes in archive_read_set_options(3). Examples of supported options: iso9660:joliet Support Joliet extensions. This is enabled by default, use !joliet or iso9660:!joliet to disable. iso9660:rockridge Support Rock Ridge extensions. This is enabled by de‐ fault, use !rockridge or iso9660:!rockridge to disable. gzip:compression-level A decimal integer from 1 to 9 specifying the gzip com‐ pression level. gzip:timestamp Store timestamp. This is enabled by default, use !timestamp or gzip:!timestamp to disable. lrzip:compression=type Use type as compression method. Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, extremely slow). lrzip:compression-level A decimal integer from 1 to 9 specifying the lrzip com‐ pression level. lz4:compression-level A decimal integer from 1 to 9 specifying the lzop com‐ pression level. lz4:stream-checksum Enable stream checksum. This is by default, use lz4:!stream-checksum to disable. lz4:block-checksum Enable block checksum (Disabled by default). lz4:block-size A decimal integer from 4 to 7 specifying the lz4 compres‐ sion block size (7 is set by default). lz4:block-dependence Use the previous block of the block being compressed for a compression dictionary to improve compression ratio. zstd:compression-level=N A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. zstd:threads=N Specify the number of worker threads to use, or 0 to use as many threads as there are CPU cores in the system. zstd:frame-per-file Start a new compression frame at the beginning of each file in the archive. zstd:min-frame-in=N In combination with zstd:frame-per-file, do not start a new compression frame unless the uncompressed size of the current frame is at least N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilo‐ bytes, megabytes or gigabytes respectively. zstd:min-frame-out=N, zstd:min-frame-size=N In combination with zstd:frame-per-file, do not start a new compression frame unless the compressed size of the current frame is at least N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilo‐ bytes, megabytes or gigabytes respectively. zstd:max-frame-in=N, zstd:max-frame-size=N Start a new compression frame as soon as possible after the uncompressed size of the current frame exceeds N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilobytes, megabytes or gigabytes re‐ spectively. Values less than 1,024 will be rejected. zstd:max-frame-out=N Start a new compression frame as soon as possible after the compressed size of the current frame exceeds N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilobytes, megabytes or gigabytes respec‐ tively. Values less than 1,024 will be rejected. lzop:compression-level A decimal integer from 1 to 9 specifying the lzop com‐ pression level. xz:compression-level A decimal integer from 0 to 9 specifying the xz compres‐ sion level. xz:threads Specify the number of worker threads to use. Setting threads to a special value 0 makes xz(1) use as many threads as there are CPU cores on the system. mtree:keyword The mtree writer module allows you to specify which mtree keywords will be included in the output. Supported key‐ words include: cksum, device, flags, gid, gname, indent, link, md5, mode, nlink, rmd160, sha1, sha256, sha384, sha512, size, time, uid, uname. The default is equiva‐ lent to: “device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname”. mtree:all Enables all of the above keywords. You can also use mtree:!all to disable all keywords. mtree:use-set Enable generation of /set lines in the output. mtree:indent Produce human-readable output by indenting options and splitting lines to fit into 80 columns. zip:compression=type Use type as compression method. Supported values are store (uncompressed) and deflate (gzip algorithm). zip:encryption Enable encryption using traditional zip encryption. zip:encryption=type Use type as encryption type. Supported values are zipcrypt (traditional zip encryption), aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ tion). read_concatenated_archives Ignore zeroed blocks in the archive, which occurs when multiple tar archives have been concatenated together. Without this option, only the contents of the first con‐ catenated archive would be read. This option is compara‐ ble to the -i, --ignore-zeros option of GNU tar. If a provided option is not supported by any module, that is a fatal error. -P, --absolute-paths Preserve pathnames. By default, absolute pathnames (those that begin with a / character) have the leading slash removed both when creating archives and extracting from them. Also, tar will refuse to extract archive entries whose pathnames contain .. or whose target directory would be altered by a symlink. This op‐ tion suppresses these behaviors. -p, --insecure, --preserve-permissions (x mode only) Preserve file permissions. Attempt to restore the full permissions, including file modes, file attributes or file flags, extended file attributes and ACLs, if available, for each item extracted from the archive. This is the reverse of --no-same-permissions and the default if tar is being run as root. It can be partially overridden by also specifying --no-acls, --no-fflags, --no-mac-metadata or --no-xattrs. --passphrase passphrase The passphrase is used to extract or create an encrypted archive. Currently, zip is the only supported format that supports encryp‐ tion. You shouldn't use this option unless you realize how inse‐ cure use of this option is. --posix (c, r, u mode only) Synonym for --format pax -q, --fast-read (x and t mode only) Extract or list only the first archive entry that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by convention, later en‐ tries overwrite earlier entries. This option is provided as a performance optimization. --read-sparse (c, r, u modes only) Read sparse file information from disk. This is the reverse of --no-read-sparse and the default behavior. -S (x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similar to the conv=sparse option of dd. -s pattern Modify file or archive member names according to pattern. The pattern has the format /old/new/[bghHprRsS] where old is a basic regular expression, new is the replacement string of the matched part, and the optional trailing letters modify how the replace‐ ment is handled. If old is not matched, the pattern is skipped. Within new, ~ is substituted with the match, \1 to \9 with the content of the corresponding captured group. The optional trail‐ ing g specifies that matching should continue after the matched part and stop on the first unmatched pattern. The optional trailing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies that after a successful substitution the original path name and the new path name should be printed to standard error. The optional trailing b specifies that the substitution should be matched from the be‐ ginning of the string rather than from right after the position at which the previous matching substitution ended. Optional trailing H, R, or S characters suppress substitutions for hardlink targets, regular filenames, or symlink targets, respec‐ tively. Optional trailing h, r, or s characters enable substitu‐ tions for hardlink targets, regular filenames, or symlink tar‐ gets, respectively. The default is hrs which applies substitu‐ tions to all names. In particular, it is never necessary to specify h, r, or s. --safe-writes (x mode only) Extract files atomically. By default tar unlinks the original file with the same name as the extracted file (if it exists), and then creates it immediately under the same name and writes to it. For a short period of time, applications trying to access the file might not find it, or see incomplete results. If --safe-writes is enabled, tar first creates a unique temporary file, then writes the new contents to the temporary file, and fi‐ nally renames the temporary file to its final name atomically us‐ ing rename(2). This guarantees that an application accessing the file, will either see the old contents or the new contents at all times. --same-owner (x mode only) Extract owner and group IDs. This is the reverse of --no-same-owner and the default behavior if tar is run as root. --strip-components count Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion patterns but before security checks. -T filename, --files-from filename In x or t mode, tar will read the list of names to be extracted from filename. In c mode, tar will read names to be archived from filename. The special name “-C” on a line by itself will cause the current directory to be changed to the directory speci‐ fied on the following line. Names are terminated by newlines un‐ less --null is specified. Note that --null also disables the special handling of lines containing “-C”. Note: If you are generating lists of files using find(1), you probably want to use -n as well. --totals (c, r, u modes only) After archiving all files, print a summary to stderr. -U, --unlink, --unlink-first (x mode only) Unlink files before creating them. This can be a minor performance optimization if most files already exist, but can make things slower if most files do not already exist. This flag also causes tar to remove intervening directory symlinks in‐ stead of reporting an error. See the SECURITY section below for more details. --uid id Use the provided user id number and ignore the user name from the archive. On create, if --uname is not also specified, the user name will be set to match the user id. --uname name Use the provided user name. On extract, this overrides the user name in the archive; if the provided user name does not exist on the system, it will be ignored and the user id (from the archive or from the --uid option) will be used instead. On create, this sets the user name that will be stored in the archive; the name is not verified against the system user database. --use-compress-program program Pipe the input (in x or t mode) or the output (in c mode) through program instead of using the builtin compression support. --owner name[:uid] Use the provided user, if uid is not provided, name can be either an username or numeric id. See the --uname option for details. -v, --verbose Produce verbose output. In create and extract modes, tar will list each file name as it is read from or written to the archive. In list mode, tar will produce output similar to that of ls(1). An additional -v option will also provide ls-like details in cre‐ ate and extract mode. --version Print version of tar and libarchive, and exit. -w, --confirmation, --interactive Ask for confirmation for every action. -X filename, --exclude-from filename Read a list of exclusion patterns from the specified file. See --exclude for more information about the handling of exclusions. --xattrs (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of --no-xattrs and the default be‐ havior in c, r, and u modes or if tar is run in x mode as root. -y (c mode only) Compress the resulting archive with bzip2(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes bzip2 compression automatically when reading archives. -Z, --compress, --uncompress (c mode only) Compress the resulting archive with compress(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes compress compression automatically when reading archives. -z, --gunzip, --gzip (c mode only) Compress the resulting archive with gzip(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes gzip compression automatically when reading archives. ENVIRONMENT The following environment variables affect the execution of tar: TAR_READER_OPTIONS The default options for format readers and compression readers. The --options option overrides this. TAR_WRITER_OPTIONS The default options for format writers and compression writers. The --options option overrides this. LANG The locale to use. See environ(7) for more information. TAPE The default device. The -f option overrides this. Please see the description of the -f option above for more details. TZ The timezone to use when displaying dates. See environ(7) for more information. EXIT STATUS The tar utility exits 0 on success, and >0 if an error occurs. EXAMPLES The following creates a new archive called file.tar.gz that contains two files source.c and source.h: tar -czf file.tar.gz source.c source.h To view a detailed table of contents for this archive: tar -tvf file.tar.gz To extract all entries from the archive on the default tape drive: tar -x To examine the contents of an ISO 9660 cdrom image: tar -tf image.iso To move file hierarchies, invoke tar as tar -cf - -C srcdir . | tar -xpf - -C destdir or more traditionally cd srcdir ; tar -cf - . | (cd destdir ; tar -xpf -) In create mode, the list of files and directories to be archived can also include directory change instructions of the form -Cfoo/baz and archive inclusions of the form @@archive-file. For example, the command line tar -c -f new.tar foo1 @@old.tgz -C/tmp foo2 will create a new archive new.tar. tar will read the file foo1 from the current directory and add it to the output archive. It will then read each entry from old.tgz and add those entries to the output archive. Fi‐ nally, it will switch to the /tmp directory and add foo2 to the output archive. An input file in mtree(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ from existing data on disk: $ cat input.mtree #mtree usr/bin uid=0 gid=0 mode=0755 type=dir usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls $ tar -cvf output.tar @@input.mtree The --newer and --newer-mtime switches accept a variety of common date and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12 19:14”, “5 minutes ago”, and “19:14 PST May 1”. The --options argument can be used to control various details of archive generation or reading. For example, you can generate mtree output which only contains type, time, and uid keywords: tar -cf file.tar --format=mtree --options='!all,type,time,uid' dir or you can set the compression level used by gzip or xz compression: tar -czf file.tar --options='compression-level=9'. For more details, see the explanation of the archive_read_set_options() and archive_write_set_options() API calls that are described in archive_read(3) and archive_write(3). COMPATIBILITY The bundled-arguments format is supported for compatibility with historic implementations. It consists of an initial word (with no leading - char‐ acter) in which each character indicates an option. Arguments follow as separate words. The order of the arguments must match the order of the corresponding characters in the bundled command word. For example, tar tbf 32 file.tar specifies three flags t, b, and f. The b and f flags both require argu‐ ments, so there must be two additional items on the command line. The 32 is the argument to the b flag, and file.tar is the argument to the f flag. The mode options c, r, t, u, and x and the options b, f, l, m, o, v, and w comply with SUSv2. For maximum portability, scripts that invoke tar should use the bundled- argument format above, should limit themselves to the c, t, and x modes, and the b, f, m, v, and w options. Additional long options are provided to improve compatibility with other tar implementations. SECURITY Certain security issues are common to many archiving programs, including tar. In particular, carefully-crafted archives can request that tar ex‐ tract files to locations outside of the target directory. This can po‐ tentially be used to cause unwitting users to overwrite files they did not intend to overwrite. If the archive is being extracted by the supe‐ ruser, any file on the system can potentially be overwritten. There are three ways this can happen. Although tar has mechanisms to protect against each one, savvy users should be aware of the implications: • Archive entries can have absolute pathnames. By default, tar re‐ moves the leading / character from filenames before restoring them to guard against this problem. • Archive entries can have pathnames that include .. components. By default, tar will not extract files containing .. components in their pathname. • Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to an‐ other directory, then use that link to restore a file into that directory. To guard against this, tar checks each extracted path for symlinks. If the final path element is a symlink, it will be removed and replaced with the archive entry. If -U is specified, any intermediate symlink will also be unconditionally removed. If neither -U nor -P is specified, tar will refuse to extract the entry. To protect yourself, you should be wary of any archives that come from untrusted sources. You should examine the contents of an archive with tar -tf filename before extraction. You should use the -k option to ensure that tar will not overwrite any existing files or the -U option to remove any pre-ex‐ isting files. You should generally not extract archives while running with super-user privileges. Note that the -P option to tar disables the security checks above and allows you to extract an archive while preserv‐ ing any absolute pathnames, .. components, or symlinks to other directo‐ ries. SEE ALSO bzip2(1), compress(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), xz(1), libarchive(3), libarchive-formats(5), tar(5) STANDARDS There is no current POSIX standard for the tar command; it appeared in ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX specification for pax. The ustar and pax interchange file formats are defined by IEEE Std 1003.1-2001 (“POSIX.1”) for the pax command. HISTORY A tar command appeared in Seventh Edition Unix, which was released in January, 1979. There have been numerous other implementations, many of which extended the file format. John Gilmore's pdtar public-domain im‐ plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in FreeBSD beginning with FreeBSD 1.0. This is a complete re-implementation based on the libarchive(3) library. It was first released with FreeBSD 5.4 in May, 2005. BUGS This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition of the -l option. Note that GNU tar prior to version 1.15 treated -l as a synonym for the --one-file-system option. The -C dir option may differ from historic implementations. All archive output is written in correctly-sized blocks, even if the out‐ put is being compressed. Whether or not the last output block is padded to a full block size varies depending on the format and the output de‐ vice. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many com‐ pressors, including gzip(1) and bzip2(1), complain about the null padding when decompressing an archive created by tar, although they still extract it correctly. The compression and decompression is implemented internally, so there may be insignificant differences between the compressed output generated by tar -czf - file and that generated by tar -cf - file | gzip The default should be to read and write archives to the standard I/O paths, but tradition (and POSIX) dictates otherwise. The r and u modes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using c mode with the @@archive-file extension. To archive a file called @@foo or -foo you must specify it as ./@@foo or ./-foo, respectively. In create mode, a leading ./ is always removed. A leading / is stripped unless the -P option is specified. There needs to be better support for file selection on both create and extract. There is not yet any support for multi-volume archives. Converting between dissimilar archive formats (such as tar and cpio) us‐ ing the @@- convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) d916 1 a916 1 BSD April 23, 2024 BSD @ 1.10 log @libarchive: updated to 3.7.3 Libarchive 3.7.3 is a feature, security and bugfix release. New features: PCRE2 support add trailing letter b to bsdtar(1) substitute pattern add support for long options "--group" and "--owner" to tar(1) Security fixes: Fix possible vulnerability in tar error reporting introduced in f27c173 Important bugfixes: ISO9660: preserve the natural order of links rar5: fix decoding unicode filenames on Windows rar5: fix infinite loop if during rar5 decompression the last block produced no data xz filter: fix incorrect eof at the end of an lzip member zip: fix end-of-data marker processing when decompressing zip archives multiple bsdunzip(1) fixes filetime truncation fix on Windows @ text @d435 1 a435 1 zstd:compression-level d439 3 a441 4 zstd:threads Specify the number of worker threads to use. Setting threads to a special value 0 makes zstd(1) use as many threads as there are CPU cores on the system. d896 1 a896 1 BSD March 1, 2024 BSD @ 1.9 log @libarchive: updated to 3.7.2 Libarchive 3.7.2 is a security, bugfix and feature release. Security fixes: Multiple vulnerabilities have been fixed in the PAX writer (1b4e0d0) Important bugfixes: bsdunzip(1) now correctly handles arguments following an -x after the zipfile New features: bsdunzip(1) now supports the "--version" flag 7-zip reader now translates Windows permissions into UNIX permissions uudecode filter in raw mode now supports file name and file mode zstd filter now supports the "long" write option Libarchive 3.7.1 is a security, feature and bugfix release. Security fixes: SEGV and stack buffer overflow in verbose mode of cpio Feature updates: bsdunzip updated to match latest upstream code Important bugfixes: miscellaneous functional bugfixes build fixes on multiple platforms Libarchive 3.7.0 is a feature and bugfix release. New features: bsdunzip: new tool ported from FreeBSD drop-in replacement for Info-ZIP unzip, not yet ported for Windows 7zip reader: support for Zstandard compression 7zip reader: support for ARM64 filter zstd filter: support for multi-frame zstd archives Other notable bugfixes and improvements: pax: fix year 2038 problem on platforms with 64-bit time_t Windows: Universal Windows Platform (UWP) fixes and improvements Windows: bcrypt usage fixes and improvements Windows: time function usage fixes and improvements @ text @d162 5 d262 2 a263 1 x mode as root. d446 7 a452 1 zstd:min-frame-size=N d454 16 a469 5 new compression frame unless the current frame is at least N bytes. zstd:max-frame-size=N Start a new compression frame as soon as the current frame exceeds N bytes. d560 1 a560 1 pattern has the format /old/new/[ghHprRsS] where old is a basic d571 11 a581 7 name should be printed to standard error. Optional trailing H, R, or S characters suppress substitutions for hardlink targets, regular filenames, or symlink targets, respectively. Optional trailing h, r, or s characters enable substitutions for hardlink targets, regular filenames, or symlink targets, respectively. The default is hrs which applies substitutions to all names. In particular, it is never necessary to specify h, r, or s. d647 4 d897 1 a897 1 BSD December 1, 2022 BSD @ 1.8 log @libarchive: Update to 3.4.3 Libarchive 3.4.3 is a feature and bugfix release. New features: support for pzstd compressed files (#1357) support for RHT.security.selinux tar extended attribute (#1348) Important bugfixes: various zstd fixes and improvements (#1342 #1352 #1359) child process handling fixes (#1372) Libarchive 3.4.2 is a feature and security release. New features: support for atomic file extraction (bsdtar -x --safe-writes) (#1289) support for mbed TLS (PolarSSL) (#1301) Important bugfixes: security fixes in RAR5 reader (#1280 #1326) compression buffer fix in XAR writer (#1317) fix uname and gname longer than 32 characters in PAX writer (#1319) fix segfault when archiving hard links in ISO9660 and XAR writers (#1325) fix support for extracting 7z archive entries with Delta filter (#987) Libarchive 3.4.1 is a feature and security release. New features: Unicode filename support for reading lha/lzh archives New pax write option "xattrhdr" Important bugfixes: security fixes in wide string processing (#1276 #1298) security fixes in RAR5 reader (#1212 #1217 #1296) security fixes and optimizations to write filter logic (#351) security fix related to use of readlink(2) (1dae5a5) sparse file handling fixes (#1218 #1260) Thanks to all contributors and bug reporters. Special thanks to Christos Zoulas (@@zoulasc) from NetBSD for the atomic file extraction feature. @ text @d4 1 a4 1 tar -- manipulate tape archives d7 1 a7 1 tar [bundled-flags ] [ | ...] d18 2 a19 2 The first synopsis form shows a ``bundled'' option word. This usage is provided for compatibility with historical implementations. See COMPATI- d22 1 a22 1 The other synopsis forms show the preferred usage. The first option to d24 1 a24 1 -c Create a new archive containing the specified items. The long d26 1 a26 1 -r Like -c, but new entries are appended to the archive. Note that d28 3 a30 3 The -f option is required. The long option form is --append. -t List archive contents to stdout. The long option form is --list. -u Like -r, but new entries are added only if they have a modifica- d32 1 a32 1 Note that this only works on uncompressed archives stored in reg- d35 3 a37 3 -x Extract to disk from the archive. If a file with the same name appears more than once in the archive, each copy will be extracted, with later copies overwriting (replacing) earlier d41 1 a41 1 archive in the order specified on the command line. By default, the con- d44 2 a45 2 In extract or list mode, the entire command line is read and parsed before the archive is opened. The pathnames or patterns on the command d50 1 a50 1 Unless specifically stated otherwise, options are applicable in all oper- d54 3 a56 3 (c and r modes only) The specified archive is opened and the entries in it will be appended to the current archive. As a sim- ple example, d63 1 a63 1 reads an archive from standard input (whose format will be deter- d65 1 a65 1 format archive on stdout. In this way, tar can be used to con- d69 1 a69 1 (c mode only) Use the archive suffix to decide a set of the for- d72 1 a72 1 creates a new archive with restricted pax format and gzip com- d75 1 a75 1 creates a new archive with restricted pax format and bzip2 com- d80 2 a81 2 ignores the ``-j'' option, and creates a new archive with restricted pax format and gzip compression, d117 1 a117 1 Do not process files or directories that match the specified pat- d122 3 a124 3 Do not process files or directories internally used by the ver- sion control systems 'Arch', 'Bazaar', 'CVS', 'Darcs', 'Mercurial', 'RCS', 'SCCS', 'SVN' and 'git'. d133 6 a138 6 (c, r, u mode only) Use the specified format for the created ar- chive. Supported formats include ``cpio'', ``pax'', ``shar'', and ``ustar''. Other formats may also be supported; see libarchive-formats(5) for more information about currently-sup- ported formats. In r and u modes, when extending an existing ar- chive, the format specified here must be compatible with the for- d162 1 a162 1 -H (c and r modes only) Symbolic links named on the command line d166 1 a166 1 -h (c and r modes only) Synonym for -L. d168 1 a168 1 -I Synonym for -T. d173 2 a174 2 (x mode only) Mac OS X specific (v10.6 or later). Compress extracted regular files with HFS+ compression. d177 1 a177 1 An alias of --options read_concatenated_archives for compatibil- d181 3 a183 3 Process only files or directories that match the specified pat- tern. Note that exclusions specified with --exclude take prece- dence over inclusions. If no inclusions are explicitly speci- d189 1 a189 1 old.tgz containing the string 'foo'. d192 4 a195 4 (c mode only) Compress the resulting archive with xz(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes XZ compression automatically when reading archives. d213 1 a213 1 (c and r modes only) All symbolic links will be followed. Nor- d227 1 a227 1 --lz4 (c mode only) Compress the archive with lz4-compatible compres- d229 1 a229 1 ignored. Note that this tar implementation recognizes lz4 com- d232 1 a232 1 --zstd (c mode only) Compress the archive with zstd-compatible compres- d234 1 a234 1 ignored. Note that this tar implementation recognizes zstd com- d238 4 a241 5 LZMA algorithm. In extract or list modes, this option is ignored. Use of this option is discouraged and new archives should be created with --xz instead. Note that this tar imple- mentation recognizes LZMA compression automatically when reading archives. d243 1 a243 1 --lzop (c mode only) Compress the resulting archive with lzop(1). In d267 2 a268 2 (c, r, u modes only) Like --newer, except it compares mtime entries instead of ctime entries. d284 1 a284 1 extracted regular files which were compressed with HFS+ compres- d289 1 a289 1 characters, not by newlines. This is often used to read file- d294 1 a294 1 NFSv4 ACLs. This is the reverse of --acls and the default behav- d309 4 d315 1 a315 1 replace the original ones. This is the reverse of --safe-writes. d330 2 a331 2 attributes. This is the reverse of --xattrs and the default behavior if tar is run as non-root in x mode. d336 1 a336 1 of the numeric user and group ids. On create, it causes user and d345 1 a345 1 -o (x mode) Use the user and group of the user running the program d352 1 a352 1 -o (c, r, u mode) A synonym for --format ustar d359 2 a360 2 (c, r, u modes only) Like --older, except it compares mtime entries instead of ctime entries. d380 1 a380 1 The key will be set to the specified value in every mod- d397 1 a397 1 Support Joliet extensions. This is enabled by default, d400 2 a401 2 Support Rock Ridge extensions. This is enabled by default, use !rockridge or iso9660:!rockridge to disable. d403 1 a403 1 A decimal integer from 1 to 9 specifying the gzip com- d413 1 a413 1 A decimal integer from 1 to 9 specifying the lrzip com- d416 1 a416 1 A decimal integer from 1 to 9 specifying the lzop com- d424 1 a424 1 A decimal integer from 4 to 7 specifying the lz4 compres- d433 14 d448 1 a448 1 A decimal integer from 1 to 9 specifying the lzop com- d451 1 a451 1 A decimal integer from 0 to 9 specifying the xz compres- d453 4 d459 1 a459 1 keywords will be included in the output. Supported key- d462 3 a464 3 sha512, size, time, uid, uname. The default is equiva- lent to: ``device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname''. d466 1 a466 1 Enables all of the above keywords. You can also use d481 1 a481 1 AES-128 encryption) and aes256 (WinZip AES-256 encryp- d486 2 a487 2 Without this option, only the contents of the first con- catenated archive would be read. This option is compara- d497 2 a498 2 whose target directory would be altered by a symlink. This option suppresses these behaviors. d511 2 a512 2 Currently, zip is the only supported format that supports encryp- tion. You shouldn't use this option unless you realize how inse- d523 2 a524 2 multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a d527 5 a531 1 -S (x mode only) Extract files as sparse files. For every block on d533 1 a533 1 otherwise. This works similar to the conv=sparse option of dd. d539 1 a539 1 part, and the optional trailing letters modify how the replace- d542 1 a542 1 content of the corresponding captured group. The optional trail- d563 5 a567 5 file, then writes the new contents to the temporary file, and finally renames the temporary file to its final name atomically using rename(2). This guarantees that an application accessing the file, will either see the old contents or the new contents at all times. d570 1 a570 1 (x mode only) Extract owner and group IDs. This is the reverse d583 5 a587 5 from filename. The special name ``-C'' on a line by itself will cause the current directory to be changed to the directory speci- fied on the following line. Names are terminated by newlines unless --null is specified. Note that --null also disables the special handling of lines containing ``-C''. Note: If you are d598 4 a601 4 can make things slower if most files do not already exist. This flag also causes tar to remove intervening directory symlinks instead of reporting an error. See the SECURITY section below for more details. d624 1 a624 1 An additional -v option will also provide ls-like details in cre- d634 1 a634 1 Read a list of exclusion patterns from the specified file. See d638 3 a640 3 (c, r, u, x modes only) Archive or extract extended file attributes. This is the reverse of --no-xattrs and the default behavior in c, r, and u modes or if tar is run in x mode as root. d642 1 a642 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d654 1 a654 1 (c mode only) Compress the resulting archive with gzip(1). In d663 2 a664 2 The default options for format readers and compression read- ers. The --options option overrides this. d667 2 a668 2 The default options for format writers and compression writ- ers. The --options option overrides this. d670 1 a670 1 LANG The locale to use. See environ(7) for more information. d672 2 a673 2 TAPE The default device. The -f option overrides this. Please see the description of the -f option above for more details. d675 2 a676 2 TZ The timezone to use when displaying dates. See environ(7) for more information. d704 1 a704 1 will create a new archive new.tar. tar will read the file foo1 from the d706 2 a707 2 each entry from old.tgz and add those entries to the output archive. Finally, it will switch to the /tmp directory and add foo2 to the output d721 2 a722 2 and time specifications, including ``12 Mar 2005 7:14:29pm'', ``2005-03-12 19:14'', ``5 minutes ago'', and ``19:14 PST May 1''. d736 1 a736 1 implementations. It consists of an initial word (with no leading - char- d741 1 a741 1 specifies three flags t, b, and f. The b and f flags both require argu- d758 4 a761 4 tar. In particular, carefully-crafted archives can request that tar extract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files they did not intend to overwrite. If the archive is being extracted by the supe- d766 2 a767 2 o Archive entries can have absolute pathnames. By default, tar removes the leading / character from filenames before restoring d770 1 a770 1 o Archive entries can have pathnames that include .. components. d774 4 a777 4 o Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that directory. To guard against this, tar checks each extracted path d784 1 a784 1 untrusted sources. You should examine the contents of an archive with d786 3 a788 3 before extraction. You should use the -k option to ensure that tar will not overwrite any existing files or the -U option to remove any pre- existing files. You should generally not extract archives while running d790 2 a791 2 security checks above and allows you to extract an archive while preserv- ing any absolute pathnames, .. components, or symlinks to other directo- d800 4 a803 5 ISO/IEC 9945-1:1996 (``POSIX.1'') but was dropped from IEEE Std 1003.1-2001 (``POSIX.1''). The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX speci- fication for pax. d806 1 a806 1 1003.1-2001 (``POSIX.1'') for the pax command. d811 3 a813 3 which extended the file format. John Gilmore's pdtar public-domain implementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in d820 1 a820 1 This program follows ISO/IEC 9945-1:1996 (``POSIX.1'') for the definition d826 1 a826 1 All archive output is written in correctly-sized blocks, even if the out- d828 5 a832 5 to a full block size varies depending on the format and the output device. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many com- d861 4 a864 4 Converting between dissimilar archive formats (such as tar and cpio) using the @@- convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) d866 1 a866 1 BSD January 31, 2020 BSD @ 1.7 log @Update for libarchive-3.4.0: - improvements for Android APK and JAR archives - better support for non-recursive list and extract - tar --exclude-vcs support - fixes for file attributes and flags handling - zipx support - rar 5.0 reader @ text @d4 1 a4 1 tar — manipulate tape archives d7 1 a7 1 tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...] d18 2 a19 2 The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See COMPATI‐ d30 1 a30 1 -u Like -r, but new entries are added only if they have a modifica‐ d32 1 a32 1 Note that this only works on uncompressed archives stored in reg‐ d36 2 a37 2 appears more than once in the archive, each copy will be ex‐ tracted, with later copies overwriting (replacing) earlier d41 1 a41 1 archive in the order specified on the command line. By default, the con‐ d44 2 a45 2 In extract or list mode, the entire command line is read and parsed be‐ fore the archive is opened. The pathnames or patterns on the command d50 1 a50 1 Unless specifically stated otherwise, options are applicable in all oper‐ d54 3 a56 3 (c and r modes only) The specified archive is opened and the en‐ tries in it will be appended to the current archive. As a simple example, d63 1 a63 1 reads an archive from standard input (whose format will be deter‐ d65 1 a65 1 format archive on stdout. In this way, tar can be used to con‐ d69 1 a69 1 (c mode only) Use the archive suffix to decide a set of the for‐ d72 1 a72 1 creates a new archive with restricted pax format and gzip com‐ d75 1 a75 1 creates a new archive with restricted pax format and bzip2 com‐ d80 2 a81 2 ignores the “-j” option, and creates a new archive with re‐ stricted pax format and gzip compression, d87 1 a87 1 ACLs. This is the reverse of --no-acls and the default behavior d89 3 a91 3 mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the --mac-metadata option is preferred. d117 1 a117 1 Do not process files or directories that match the specified pat‐ d122 3 a124 3 Do not process files or directories internally used by the ver‐ sion control systems ‘CVS’, ‘RCS’, ‘SCCS’, ‘SVN’, ‘Arch’, ‘Bazaar’, ‘Mercurial’ and ‘Darcs’. d133 6 a138 6 (c, r, u mode only) Use the specified format for the created ar‐ chive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see libarchive-formats(5) for more information about currently-sup‐ ported formats. In r and u modes, when extending an existing ar‐ chive, the format specified here must be compatible with the for‐ d173 2 a174 2 (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ tracted regular files with HFS+ compression. d177 1 a177 1 An alias of --options read_concatenated_archives for compatibil‐ d181 3 a183 3 Process only files or directories that match the specified pat‐ tern. Note that exclusions specified with --exclude take prece‐ dence over inclusions. If no inclusions are explicitly speci‐ d189 1 a189 1 old.tgz containing the string ‘foo’. d192 4 a195 4 (c mode only) Compress the resulting archive with xz(1). In ex‐ tract or list modes, this option is ignored. Note that this tar implementation recognizes XZ compression automatically when read‐ ing archives. d213 1 a213 1 (c and r modes only) All symbolic links will be followed. Nor‐ d227 1 a227 1 --lz4 (c mode only) Compress the archive with lz4-compatible compres‐ d229 1 a229 1 ignored. Note that this tar implementation recognizes lz4 com‐ d232 1 a232 1 --zstd (c mode only) Compress the archive with zstd-compatible compres‐ d234 1 a234 1 ignored. Note that this tar implementation recognizes zstd com‐ d238 5 a242 4 LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives should be created with --xz instead. Note that this tar implementation recognizes LZMA compression automatically when reading archives. d254 1 a254 1 (c, r, u and x mode only) Mac OS X specific. Archive or extract d256 1 a256 1 AppleDouble format. This is the reverse of --no-mac-metadata. d268 2 a269 2 (c, r, u modes only) Like --newer, except it compares mtime en‐ tries instead of ctime entries. d285 1 a285 1 extracted regular files which were compressed with HFS+ compres‐ d290 1 a290 1 characters, not by newlines. This is often used to read file‐ d295 1 a295 1 NFSv4 ACLs. This is the reverse of --acls and the default behav‐ d301 1 a301 1 or file flags. This is the reverse of --fflags and the default d305 1 a305 1 (x mode only) Mac OS X specific. Do not archive or extract ACLs d307 1 a307 1 format. This is the reverse of --mac-metadata. and the default d310 4 d327 2 a328 2 attributes. This is the reverse of --xattrs and the default be‐ havior if tar is run as non-root in x mode. d356 2 a357 2 (c, r, u modes only) Like --older, except it compares mtime en‐ tries instead of ctime entries. d377 1 a377 1 The key will be set to the specified value in every mod‐ d387 6 a392 1 The currently supported modules and keys are: d397 2 a398 2 Support Rock Ridge extensions. This is enabled by de‐ fault, use !rockridge or iso9660:!rockridge to disable. d400 1 a400 1 A decimal integer from 1 to 9 specifying the gzip com‐ d403 1 a403 1 Store timestamp. This is enabled by default, use d410 1 a410 1 A decimal integer from 1 to 9 specifying the lrzip com‐ d413 1 a413 1 A decimal integer from 1 to 9 specifying the lzop com‐ d416 1 a416 1 Enable stream checksum. This is by default, use d421 1 a421 1 A decimal integer from 4 to 7 specifying the lz4 compres‐ d427 3 a429 2 A decimal integer from 1 to 22 specifying the zstd com‐ pression level. d431 1 a431 1 A decimal integer from 1 to 9 specifying the lzop com‐ d434 1 a434 1 A decimal integer from 0 to 9 specifying the xz compres‐ d438 1 a438 1 keywords will be included in the output. Supported key‐ d441 3 a443 3 sha512, size, time, uid, uname. The default is equiva‐ lent to: “device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname”. d460 1 a460 1 AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ d465 2 a466 2 Without this option, only the contents of the first con‐ catenated archive would be read. This option is compara‐ d476 2 a477 2 whose target directory would be altered by a symlink. This op‐ tion suppresses these behaviors. d483 1 a483 1 item extracted from the archive. This is the reverse of d485 1 a485 1 root. It can be partially overridden by also specifying d490 2 a491 2 Currently, zip is the only supported format that supports encryp‐ tion. You shouldn't use this option unless you realize how inse‐ d502 2 a503 2 multiple entries with the same name and, by convention, later en‐ tries overwrite earlier entries. This option is provided as a d514 1 a514 1 part, and the optional trailing letters modify how the replace‐ d517 1 a517 1 content of the corresponding captured group. The optional trail‐ d531 13 d558 5 a562 5 from filename. The special name “-C” on a line by itself will cause the current directory to be changed to the directory speci‐ fied on the following line. Names are terminated by newlines un‐ less --null is specified. Note that --null also disables the special handling of lines containing “-C”. Note: If you are d574 3 a576 3 flag also causes tar to remove intervening directory symlinks in‐ stead of reporting an error. See the SECURITY section below for more details. d599 1 a599 1 An additional -v option will also provide ls-like details in cre‐ d613 3 a615 3 (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of --no-xattrs and the default be‐ havior in c, r, and u modes or if tar is run in x mode as root. d638 1 a638 1 The default options for format readers and compression read‐ d642 1 a642 1 The default options for format writers and compression writ‐ d681 2 a682 2 each entry from old.tgz and add those entries to the output archive. Fi‐ nally, it will switch to the /tmp directory and add foo2 to the output d696 2 a697 2 and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12 19:14”, “5 minutes ago”, and “19:14 PST May 1”. d711 1 a711 1 implementations. It consists of an initial word (with no leading - char‐ d716 1 a716 1 specifies three flags t, b, and f. The b and f flags both require argu‐ d733 4 a736 4 tar. In particular, carefully-crafted archives can request that tar ex‐ tract files to locations outside of the target directory. This can po‐ tentially be used to cause unwitting users to overwrite files they did not intend to overwrite. If the archive is being extracted by the supe‐ d741 2 a742 2 • Archive entries can have absolute pathnames. By default, tar re‐ moves the leading / character from filenames before restoring d745 1 a745 1 • Archive entries can have pathnames that include .. components. d749 3 a751 3 • Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to an‐ other directory, then use that link to restore a file into that d762 2 a763 2 not overwrite any existing files or the -U option to remove any pre-ex‐ isting files. You should generally not extract archives while running d765 2 a766 2 security checks above and allows you to extract an archive while preserv‐ ing any absolute pathnames, .. components, or symlinks to other directo‐ d775 5 a779 4 ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX specification for pax. d782 1 a782 1 1003.1-2001 (“POSIX.1”) for the pax command. d787 3 a789 3 which extended the file format. John Gilmore's pdtar public-domain im‐ plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in d796 1 a796 1 This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition d802 1 a802 1 All archive output is written in correctly-sized blocks, even if the out‐ d804 5 a808 5 to a full block size varies depending on the format and the output de‐ vice. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many com‐ d837 4 a840 4 Converting between dissimilar archive formats (such as tar and cpio) us‐ ing the @@- convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) d842 1 a842 1 BSD June 3, 2019 BSD @ 1.6 log @libarchive: updated to 3.3.3 libarchive 3.3.3: Avoid super-linear slowdown on malformed mtree files Many fixes for building with Visual Studio NO_OVERWRITE doesn't change existing directory attributes New support for Zstandard read and write filters @ text @d36 2 a37 2 appears more than once in the archive, each copy will be extracted, with later copies overwriting (replacing) earlier d44 2 a45 2 In extract or list mode, the entire command line is read and parsed before the archive is opened. The pathnames or patterns on the command d54 3 a56 3 (c and r modes only) The specified archive is opened and the entries in it will be appended to the current archive. As a sim‐ ple example, d80 2 a81 2 ignores the “-j” option, and creates a new archive with restricted pax format and gzip compression, d113 2 a114 2 them, clear platform-specific file flags that might prevent removal. d121 5 d127 4 a130 3 (c, r, u, x modes only) Archive or extract file flags. This is the reverse of --no-fflags and the default behavior in c, r, and u modes or if tar is run in x mode as root. d173 2 a174 2 (x mode only) Mac OS X specific (v10.6 or later). Compress extracted regular files with HFS+ compression. d192 4 a195 4 (c mode only) Compress the resulting archive with xz(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes XZ compression automatically when reading archives. d238 4 a241 5 LZMA algorithm. In extract or list modes, this option is ignored. Use of this option is discouraged and new archives should be created with --xz instead. Note that this tar imple‐ mentation recognizes LZMA compression automatically when reading archives. d254 4 a257 4 extended ACLs and extended attributes using copyfile(3) in Apple‐ Double format. This is the reverse of --no-mac-metadata. and the default behavior in c, r, and u modes or if tar is run in x mode as root. d260 1 a260 2 (c, r, u modes only) Do not recursively archive the contents of directories. d267 2 a268 2 (c, r, u modes only) Like --newer, except it compares mtime entries instead of ctime entries. d299 3 a301 3 (c, r, u, x modes only) Do not archive or extract file flags. This is the reverse of --fflags and the default behavior if tar is run as non-root in x mode. d305 3 a307 5 and extended attributes using copyfile(3) in AppleDouble format. This is the reverse of --mac-metadata. and the default behavior if tar is run as non-root in x mode. -n, --norecurse, --no-recursion d316 3 a318 3 bit, ACLs, extended attributes or extended file flags). This is the reverse of -p and the default behavior if tar is run as non- root. d321 3 a323 3 (c, r, u, x modes only) Do not archive or extract extended attributes. This is the reverse of --xattrs and the default behavior if tar is run as non-root in x mode. d351 2 a352 2 (c, r, u modes only) Like --older, except it compares mtime entries instead of ctime entries. d387 2 a388 2 Support Rock Ridge extensions. This is enabled by default, use !rockridge or iso9660:!rockridge to disable. d465 2 a466 2 whose target directory would be altered by a symlink. This option suppresses these behaviors. d470 6 a475 6 full permissions, including owner, file modes, ACLs, extended attributes and extended file flags, if available, for each item extracted from the archive. This is te reverse of --no-same-permissions and the default if tar is being run by root and can be partially overridden by also specifying --no-acls, --no-fflags, --no-mac-metadata or --no-xattrs. d491 2 a492 2 multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a d536 2 a537 2 fied on the following line. Names are terminated by newlines unless --null is specified. Note that --null also disables the d550 3 a552 3 flag also causes tar to remove intervening directory symlinks instead of reporting an error. See the SECURITY section below for more details. d589 3 a591 3 (c, r, u, x modes only) Archive or extract extended attributes. This is the reverse of --no-xattrs and the default behavior in c, r, and u modes or if tar is run in x mode as root. d657 2 a658 2 each entry from old.tgz and add those entries to the output archive. Finally, it will switch to the /tmp directory and add foo2 to the output d709 3 a711 3 tar. In particular, carefully-crafted archives can request that tar extract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files they did d717 2 a718 2 · Archive entries can have absolute pathnames. By default, tar removes the leading / character from filenames before restoring d721 1 a721 1 · Archive entries can have pathnames that include .. components. d725 3 a727 3 · Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that d738 2 a739 2 not overwrite any existing files or the -U option to remove any pre- existing files. You should generally not extract archives while running d762 3 a764 3 which extended the file format. John Gilmore's pdtar public-domain implementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in d779 4 a782 4 to a full block size varies depending on the format and the output device. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being d812 4 a815 4 Converting between dissimilar archive formats (such as tar and cpio) using the @@- convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) d817 1 a817 1 BSD October 1, 2017 BSD @ 1.5 log @Merge for libarchive-3.3.2. @ text @d187 3 a189 3 extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes XZ com‐ pression automatically when reading archives. d193 3 a195 3 extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes bzip2 compression automatically when reading archives. d217 3 a219 1 extract or list modes, this option is ignored. d222 8 a229 2 sion before writing it. In input mode, this option is ignored; lz4 compression is recognized automatically on input. d232 5 a236 4 LZMA algorithm. Use of this option is discouraged and new ar‐ chives should be created with --xz instead. Note that, unlike other tar implementations, this implementation recognizes LZMA compression automatically when reading archives. d239 3 a241 1 extract or list modes, this option is ignored. d414 3 d592 3 a594 3 extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes bzip2 compression automatically when reading archives. d598 3 a600 3 In extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes compress compression automatically when reading archives. d604 3 a606 3 extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes gzip compression automatically when reading archives. d815 1 a815 1 BSD February 25, 2017 BSD @ 1.4 log @Merge libarchive-3.3.1. @ text @d3 2 a4 2 1mNAME0m 1mtar 22m— manipulate tape archives d6 5 a10 5 1mSYNOPSIS0m 1mtar 22m[4mbundled-flags24m ⟨args⟩] [⟨4mfile24m⟩ | ⟨4mpattern24m⟩ ...] 1mtar 22m{1m-c22m} [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-r 22m| 1m-u22m} 1m-f 4m22marchive-file24m [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-t 22m| 1m-x22m} [4moptions24m] [4mpatterns24m] d12 2 a13 2 1mDESCRIPTION0m 1mtar 22mcreates and manipulates streaming archive files. This implementation d23 4 a26 4 1mtar 22mis a mode indicator from the following list: 1m-c 22mCreate a new archive containing the specified items. The long option form is 1m--create22m. 1m-r 22mLike 1m-c22m, but new entries are appended to the archive. Note that d28 3 a30 3 The 1m-f 22moption is required. The long option form is 1m--append22m. 1m-t 22mList archive contents to stdout. The long option form is 1m--list22m. 1m-u 22mLike 1m-r22m, but new entries are added only if they have a modifica‐ d33 3 a35 3 ular files. The 1m-f 22moption is required. The long form is 1m--update22m. 1m-x 22mExtract to disk from the archive. If a file with the same name d38 1 a38 1 copies. The long option form is 1m--extract22m. d40 1 a40 1 In 1m-c22m, 1m-r22m, or 1m-u 22mmode, each specified file or directory is added to the d49 1 a49 1 1mOPTIONS0m d53 1 a53 1 1m@@4m22marchive0m d57 4 a60 4 1mtar -c -f 4m22m-24m 4mnewfile24m 1m@@4m22moriginal.tar0m writes a new archive to standard output containing a file 4mnewfile0m and all of the entries from 4moriginal.tar24m. In contrast, 1mtar -c -f 4m22m-24m 4mnewfile24m 4moriginal.tar0m d62 1 a62 1 1mtar -czf 4m22m-24m 1m--format pax @@4m22m-0m d65 1 a65 1 format archive on stdout. In this way, 1mtar 22mcan be used to con‐ d68 1 a68 1 1m-a22m, 1m--auto-compress0m d71 1 a71 1 1mtar -a -cf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m d74 1 a74 1 1mtar -a -cf 4m22marchive.tar.bz2.uu24m 4msource.c24m 4msource.h0m d77 1 a77 1 1mtar -a -cf 4m22marchive.zip24m 4msource.c24m 4msource.h0m d79 1 a79 1 1mtar -a -jcf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m d82 1 a82 1 1mtar -a -jcf 4m22marchive.xxx24m 4msource.c24m 4msource.h0m d86 5 a90 5 1m--acls 22m(c, r, u, x modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--no-acls 22mand the default behavior in c, r, and u modes (except Mac OS X) or if 1mtar 22mis run in x mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the 1m--mac-metadata 22moption is d93 1 a93 1 1m-B22m, 1m--read-full-blocks0m d96 1 a96 1 1m-b 4m22mblocksize24m, 1m--block-size 4m22mblocksize0m d102 1 a102 1 1m-C 4m22mdirectory24m, 1m--cd 4m22mdirectory24m, 1m--directory 4m22mdirectory0m d107 3 a109 3 1m--chroot0m (x mode only) 1mchroot22m() to the current directory after processing any 1m-C 22moptions and before extracting any files. d111 1 a111 1 1m--clear-nochange-fflags0m d116 1 a116 1 1m--exclude 4m22mpattern0m d121 1 a121 1 1m--fflags0m d123 2 a124 2 the reverse of 1m--no-fflags 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. d126 1 a126 1 1m--format 4m22mformat0m d135 1 a135 1 1m-f 4m22mfile24m, 1m--file 4m22mfile0m d137 3 a139 3 The filename can be 4m-24m for standard input or standard output. The default varies by system; on FreeBSD, the default is 4m/dev/sa024m; on Linux, the default is 4m/dev/st024m. d141 1 a141 1 1m--gid 4m22mid0m d145 1 a145 1 if 1m--gname 22mis not also specified, the group name will be set to d148 1 a148 1 1m--gname 4m22mname0m d152 1 a152 1 1m--gid 22moption) will be used instead. On create, this sets the d156 1 a156 1 1m-H 22m(c and r modes only) Symbolic links named on the command line d160 1 a160 1 1m-h 22m(c and r modes only) Synonym for 1m-L22m. d162 1 a162 1 1m-I 22mSynonym for 1m-T22m. d164 1 a164 1 1m--help 22mShow usage. d166 1 a166 1 1m--hfsCompression0m d170 2 a171 2 1m--ignore-zeros0m An alias of 1m--options read_concatenated_archives 22mfor compatibil‐ d174 1 a174 1 1m--include 4m22mpattern0m d176 1 a176 1 tern. Note that exclusions specified with 1m--exclude 22mtake prece‐ d178 1 a178 1 fied, all entries are processed by default. The 1m--include 22moption d181 3 a183 3 1mtar -c -f 4m22mnew.tar24m 1m--include='*foo*' @@4m22mold.tgz0m creates a new archive 4mnew.tar24m containing only the entries from 4mold.tgz24m containing the string ‘foo’. d185 1 a185 1 1m-J22m, 1m--xz0m d188 1 a188 1 other 1mtar 22mimplementations, this implementation recognizes XZ com‐ d191 1 a191 1 1m-j22m, 1m--bzip22m, 1m--bzip222m, 1m--bunzip20m d194 1 a194 1 other 1mtar 22mimplementations, this implementation recognizes bzip2 d197 1 a197 1 1m-k22m, 1m--keep-old-files0m d202 1 a202 1 1m--keep-newer-files0m d206 1 a206 1 1m-L22m, 1m--dereference0m d211 1 a211 1 1m-l22m, 1m--check-links0m d215 1 a215 1 1m--lrzip0m d219 1 a219 1 1m--lz4 22m(c mode only) Compress the archive with lz4-compatible compres‐ d223 1 a223 1 1m--lzma 22m(c mode only) Compress the resulting archive with the original d225 2 a226 2 chives should be created with 1m--xz 22minstead. Note that, unlike other 1mtar 22mimplementations, this implementation recognizes LZMA d229 1 a229 1 1m--lzop 22m(c mode only) Compress the resulting archive with lzop(1). In d232 1 a232 1 1m-m22m, 1m--modification-time0m d236 1 a236 1 1m--mac-metadata0m d239 2 a240 2 Double format. This is the reverse of 1m--no-mac-metadata22m. and the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode d243 1 a243 1 1m-n22m, 1m--norecurse22m, 1m--no-recursion0m d247 1 a247 1 1m--newer 4m22mdate0m d251 2 a252 2 1m--newer-mtime 4m22mdate0m (c, r, u modes only) Like 1m--newer22m, except it compares mtime d255 1 a255 1 1m--newer-than 4m22mfile0m d259 2 a260 2 1m--newer-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--newer-than22m, except it compares mtime d263 1 a263 1 1m--nodump0m d267 2 a268 2 1m--nopreserveHFSCompression0m (x mode only) Mac OS X specific(v10.6 or later). Do not compress d273 1 a273 1 1m--null 22m(use with 1m-I 22mor 1m-T22m) Filenames or patterns are separated by null d275 1 a275 1 names output by the 1m-print0 22moption to find(1). d277 1 a277 1 1m--no-acls0m d279 3 a281 3 NFSv4 ACLs. This is the reverse of 1m--acls 22mand the default behav‐ ior if 1mtar 22mis run as non-root in x mode (on Mac OS X also in c, r and u modes). d283 1 a283 1 1m--no-fflags0m d285 1 a285 1 This is the reverse of 1m--fflags 22mand the default behavior if 1mtar0m d288 1 a288 1 1m--no-mac-metadata0m d291 2 a292 2 This is the reverse of 1m--mac-metadata22m. and the default behavior if 1mtar 22mis run as non-root in x mode. d294 1 a294 1 1m-n22m, 1m--norecurse22m, 1m--no-recursion0m d296 1 a296 1 1m--no-same-owner0m d298 1 a298 1 reverse of 1m--same-owner 22mand the default behavior if 1mtar 22mis run as d301 1 a301 1 1m--no-same-permissions0m d304 2 a305 3 the reverse of 1m-p 22mand the default behavior if 1mtar 22mis run as non- root and can be overridden by also specifying 1m--acls22m, 1m--fflags22m, 1m--mac-metadata, --same-owner22m, 1m--same-permissions 22mand 1m--xattrs22m. d307 1 a307 1 1m--no-xattrs0m d309 2 a310 2 attributes. This is the reverse of 1m--xattrs 22mand the default behavior if 1mtar 22mis run as non-root in x mode. d312 2 a313 2 1m--numeric-owner0m This is equivalent to 1m--uname 22m"" 1m--gname 22m"". On extract, it d318 1 a318 1 1m-O22m, 1m--to-stdout0m d324 1 a324 1 1m-o 22m(x mode) Use the user and group of the user running the program d326 1 a326 1 no significance unless 1m-p 22mis specified, and the program is being d331 1 a331 1 1m-o 22m(c, r, u mode) A synonym for 1m--format 4m22mustar0m d333 1 a333 1 1m--older 4m22mdate0m d337 2 a338 2 1m--older-mtime 4m22mdate0m (c, r, u modes only) Like 1m--older22m, except it compares mtime d341 1 a341 1 1m--older-than 4m22mfile0m d345 2 a346 2 1m--older-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--older-than22m, except it compares mtime d349 1 a349 1 1m--one-file-system0m d352 1 a352 1 1m--options 4m22moptions0m d358 1 a358 1 4mkey=value0m d362 3 a364 3 4mkey24m The key will be enabled in every module that supports it. This is equivalent to 4mkey24m1m=122m. 4m!key24m The key will be disabled in every module that supports d366 1 a366 1 4mmodule:key=value24m, 4mmodule:key24m, 4mmodule:!key0m d368 1 a368 1 provided only to modules whose name matches 4mmodule24m. d370 1 a370 1 1miso9660:joliet0m d372 2 a373 2 use 1m!joliet 22mor 1miso9660:!joliet 22mto disable. 1miso9660:rockridge0m d375 2 a376 2 default, use 1m!rockridge 22mor 1miso9660:!rockridge 22mto disable. 1mgzip:compression-level0m d379 1 a379 1 1mgzip:timestamp0m d381 3 a383 3 1m!timestamp 22mor 1mgzip:!timestamp 22mto disable. 1mlrzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are d386 1 a386 1 1mlrzip:compression-level0m d389 1 a389 1 1mlz4:compression-level0m d392 1 a392 1 1mlz4:stream-checksum0m d394 2 a395 2 1mlz4:!stream-checksum 22mto disable. 1mlz4:block-checksum0m d397 1 a397 1 1mlz4:block-size0m d400 1 a400 1 1mlz4:block-dependence0m d403 1 a403 1 1mlzop:compression-level0m d406 1 a406 1 1mxz:compression-level0m d409 1 a409 1 1mmtree:4m22mkeyword0m d412 3 a414 3 words include: 1mcksum22m, 1mdevice22m, 1mflags22m, 1mgid22m, 1mgname22m, 1mindent22m, 1mlink22m, 1mmd522m, 1mmode22m, 1mnlink22m, 1mrmd16022m, 1msha122m, 1msha25622m, 1msha38422m, 1msha51222m, 1msize22m, 1mtime22m, 1muid22m, 1muname22m. The default is equiva‐ d417 1 a417 1 1mmtree:all0m d419 4 a422 4 1mmtree:!all 22mto disable all keywords. 1mmtree:use-set0m Enable generation of 1m/set 22mlines in the output. 1mmtree:indent0m d425 2 a426 2 1mzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are d428 1 a428 1 1mzip:encryption0m d430 2 a431 2 1mzip:encryption22m=4mtype0m Use 4mtype24m as encryption type. Supported values are d435 1 a435 1 1mread_concatenated_archives0m d440 1 a440 1 ble to the 1m-i22m, 1m--ignore-zeros 22moption of GNU tar. d444 1 a444 1 1m-P22m, 1m--absolute-paths0m d447 2 a448 2 when creating archives and extracting from them. Also, 1mtar 22mwill refuse to extract archive entries whose pathnames contain 4m..24m or d452 1 a452 1 1m-p22m, 1m--insecure22m, 1m--preserve-permissions0m d455 5 a459 5 atributes and extended file flags, if available, for each item extracted from the archive. This is the default, if 1mtar 22mis being run by root and can be overridden by also specifying 1m--no-acls22m, 1m--no-fflags22m, 1m--no-mac-metadata, --no-same-owner22m, 1m--no-same-permissions 22mand 1m--no-xattrs22m. d461 2 a462 2 1m--passphrase 4m22mpassphrase0m The 4mpassphrase24m is used to extract or create an encrypted archive. d467 2 a468 2 1m--posix0m (c, r, u mode only) Synonym for 1m--format 4m22mpax0m d470 1 a470 1 1m-q22m, 1m--fast-read0m d479 1 a479 1 1m-S 22m(x mode only) Extract files as sparse files. For every block on d483 4 a486 4 1m-s 4m22mpattern0m Modify file or archive member names according to 4mpattern24m. The pattern has the format 4m/old/new/24m[ghHprRsS] where 4mold24m is a basic regular expression, 4mnew24m is the replacement string of the matched d488 2 a489 2 ment is handled. If 4mold24m is not matched, the pattern is skipped. Within 4mnew24m, ~ is substituted with the match, \1 to \9 with the d501 1 a501 1 The default is 4mhrs24m which applies substitutions to all names. In d504 1 a504 1 1m--same-owner0m d506 1 a506 1 of 1m--no-same-owner 22mand the default behavior if 1mtar 22mis run as d509 1 a509 1 1m--strip-components 4m22mcount0m d515 4 a518 4 1m-T 4m22mfilename24m, 1m--files-from 4m22mfilename0m In x or t mode, 1mtar 22mwill read the list of names to be extracted from 4mfilename24m. In c mode, 1mtar 22mwill read names to be archived from 4mfilename24m. The special name “-C” on a line by itself will d521 1 a521 1 unless 1m--null 22mis specified. Note that 1m--null 22malso disables the d524 1 a524 1 1m-n 22mas well. d526 1 a526 1 1m--totals0m d530 1 a530 1 1m-U22m, 1m--unlink22m, 1m--unlink-first0m d534 1 a534 1 flag also causes 1mtar 22mto remove intervening directory symlinks d538 1 a538 1 1m--uid 4m22mid0m d540 1 a540 1 archive. On create, if 1m--uname 22mis not also specified, the user d543 1 a543 1 1m--uname 4m22mname0m d547 1 a547 1 or from the 1m--uid 22moption) will be used instead. On create, this d551 1 a551 1 1m--use-compress-program 4m22mprogram0m d553 1 a553 1 4mprogram24m instead of using the builtin compression support. d555 2 a556 2 1m-v22m, 1m--verbose0m Produce verbose output. In create and extract modes, 1mtar 22mwill d558 2 a559 2 In list mode, 1mtar 22mwill produce output similar to that of ls(1). An additional 1m-v 22moption will also provide ls-like details in cre‐ d562 2 a563 2 1m--version0m Print version of 1mtar 22mand 1mlibarchive22m, and exit. d565 1 a565 1 1m-w22m, 1m--confirmation22m, 1m--interactive0m d568 1 a568 1 1m-X 4m22mfilename24m, 1m--exclude-from 4m22mfilename0m d570 1 a570 1 1m--exclude 22mfor more information about the handling of exclusions. d572 1 a572 1 1m--xattrs0m d574 2 a575 2 This is the reverse of 1m--no-xattrs 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. d577 1 a577 1 1m-y 22m(c mode only) Compress the resulting archive with bzip2(1). In d579 1 a579 1 other 1mtar 22mimplementations, this implementation recognizes bzip2 d582 1 a582 1 1m-Z22m, 1m--compress22m, 1m--uncompress0m d585 1 a585 1 unlike other 1mtar 22mimplementations, this implementation recognizes d588 1 a588 1 1m-z22m, 1m--gunzip22m, 1m--gzip0m d591 1 a591 1 other 1mtar 22mimplementations, this implementation recognizes gzip d594 2 a595 2 1mENVIRONMENT0m The following environment variables affect the execution of 1mtar22m: d599 1 a599 1 ers. The 1m--options 22moption overrides this. d603 1 a603 1 ers. The 1m--options 22moption overrides this. d607 2 a608 2 TAPE The default device. The 1m-f 22moption overrides this. Please see the description of the 1m-f 22moption above for more details. d613 2 a614 2 1mEXIT STATUS0m The 1mtar 22mutility exits 0 on success, and >0 if an error occurs. d616 4 a619 4 1mEXAMPLES0m The following creates a new archive called 4mfile.tar.gz24m that contains two files 4msource.c24m and 4msource.h24m: 1mtar -czf 4m22mfile.tar.gz24m 4msource.c24m 4msource.h0m d622 1 a622 1 1mtar -tvf 4m22mfile.tar.gz0m d625 1 a625 1 1mtar -x0m d628 1 a628 1 1mtar -tf 4m22mimage.iso0m d630 2 a631 2 To move file hierarchies, invoke 1mtar 22mas 1mtar -cf 4m22m-24m 1m-C 4m22msrcdir24m 4m.24m | 1mtar -xpf 4m22m-24m 1m-C 4m22mdestdir0m d633 1 a633 1 cd srcdir ; 1mtar -cf 4m22m-24m 4m.24m | (4mcd24m 4mdestdir24m 4m;24m 1mtar -xpf 4m22m-24m) d636 4 a639 4 include directory change instructions of the form 1m-C4m22mfoo/baz24m and archive inclusions of the form 1m@@4m22marchive-file24m. For example, the command line 1mtar -c -f 4m22mnew.tar24m 4mfoo124m 1m@@4m22mold.tgz24m 1m-C4m22m/tmp24m 4mfoo20m will create a new archive 4mnew.tar24m. 1mtar 22mwill read the file 4mfoo124m from the d641 2 a642 2 each entry from 4mold.tgz24m and add those entries to the output archive. Finally, it will switch to the 4m/tmp24m directory and add 4mfoo224m to the output d655 1 a655 1 The 1m--newer 22mand 1m--newer-mtime 22mswitches accept a variety of common date d659 1 a659 1 The 1m--options 22margument can be used to control various details of archive d661 2 a662 2 only contains 1mtype22m, 1mtime22m, and 1muid 22mkeywords: 1mtar -cf 4m22mfile.tar24m 1m--format=mtree --options='!all,type,time,uid' 4m22mdir0m d664 3 a666 3 1mtar -czf 4m22mfile.tar24m 1m--options='compression-level=9'22m. For more details, see the explanation of the 1marchive_read_set_options22m() and 1marchive_write_set_options22m() API calls that are described in d669 1 a669 1 1mCOMPATIBILITY0m d675 4 a678 4 1mtar tbf 32 4m22mfile.tar0m specifies three flags 1mt22m, 1mb22m, and 1mf22m. The 1mb 22mand 1mf 22mflags both require argu‐ ments, so there must be two additional items on the command line. The 4m320m is the argument to the 1mb 22mflag, and 4mfile.tar24m is the argument to the 1mf0m d684 3 a686 3 For maximum portability, scripts that invoke 1mtar 22mshould use the bundled- argument format above, should limit themselves to the 1mc22m, 1mt22m, and 1mx 22mmodes, and the 1mb22m, 1mf22m, 1mm22m, 1mv22m, and 1mw 22moptions. d691 1 a691 1 1mSECURITY0m d693 1 a693 1 1mtar22m. In particular, carefully-crafted archives can request that 1mtar0m d698 1 a698 1 three ways this can happen. Although 1mtar 22mhas mechanisms to protect d701 2 a702 2 1m· 22mArchive entries can have absolute pathnames. By default, 1mtar0m removes the leading 4m/24m character from filenames before restoring d705 2 a706 2 1m· 22mArchive entries can have pathnames that include 4m..24m components. By default, 1mtar 22mwill not extract files containing 4m..24m components d709 1 a709 1 1m· 22mArchive entries can exploit symbolic links to restore files to d712 1 a712 1 directory. To guard against this, 1mtar 22mchecks each extracted path d714 1 a714 1 removed and replaced with the archive entry. If 1m-U 22mis specified, d716 1 a716 1 If neither 1m-U 22mnor 1m-P 22mis specified, 1mtar 22mwill refuse to extract the d720 3 a722 3 1mtar -tf 4m22mfilename0m before extraction. You should use the 1m-k 22moption to ensure that 1mtar 22mwill not overwrite any existing files or the 1m-U 22moption to remove any pre- d724 1 a724 1 with super-user privileges. Note that the 1m-P 22moption to 1mtar 22mdisables the d726 1 a726 1 ing any absolute pathnames, 4m..24m components, or symlinks to other directo‐ d729 1 a729 1 1mSEE ALSO0m d733 1 a733 1 1mSTANDARDS0m d743 2 a744 2 1mHISTORY0m A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in d746 1 a746 1 which extended the file format. John Gilmore's 1mpdtar 22mpublic-domain d754 1 a754 1 1mBUGS0m d756 2 a757 2 of the 1m-l 22moption. Note that GNU tar prior to version 1.15 treated 1m-l 22mas a synonym for the 1m--one-file-system 22moption. d759 1 a759 1 The 1m-C 4m22mdir24m option may differ from historic implementations. d769 1 a769 1 when decompressing an archive created by 1mtar22m, although they still extract d774 1 a774 1 1mtar -czf 4m22m-24m 4mfile0m d776 1 a776 1 1mtar -cf 4m22m-24m 4mfile24m | 1mgzip0m d781 3 a783 3 The 1mr 22mand 1mu 22mmodes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using 1mc 22mmode with the 4m@@archive-file24m extension. d785 2 a786 2 To archive a file called 4m@@foo24m or 4m-foo24m you must specify it as 4m./@@foo24m or 4m./-foo24m, respectively. d788 2 a789 2 In create mode, a leading 4m./24m is always removed. A leading 4m/24m is stripped unless the 1m-P 22moption is specified. d797 1 a797 1 using the 1m@@4m22m-24m convention can cause hard link information to be lost. d801 1 a801 1 BSD February 24, 2017 BSD @ 1.3 log @Update for libarchive 3.2.1. @ text @d3 2 a4 2 NAME tar — manipulate tape archives d6 5 a10 5 SYNOPSIS tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...] tar {-c} [options] [files | directories] tar {-r | -u} -f archive-file [options] [files | directories] tar {-t | -x} [options] [patterns] d12 2 a13 2 DESCRIPTION tar creates and manipulates streaming archive files. This implementation d23 4 a26 4 tar is a mode indicator from the following list: -c Create a new archive containing the specified items. The long option form is --create. -r Like -c, but new entries are appended to the archive. Note that d28 3 a30 3 The -f option is required. The long option form is --append. -t List archive contents to stdout. The long option form is --list. -u Like -r, but new entries are added only if they have a modifica‐ d33 3 a35 3 ular files. The -f option is required. The long form is --update. -x Extract to disk from the archive. If a file with the same name d38 1 a38 1 copies. The long option form is --extract. d40 1 a40 1 In -c, -r, or -u mode, each specified file or directory is added to the d49 1 a49 1 OPTIONS d53 2 a54 2 @@archive (c and r mode only) The specified archive is opened and the d57 4 a60 4 tar -c -f - newfile @@original.tar writes a new archive to standard output containing a file newfile and all of the entries from original.tar. In contrast, tar -c -f - newfile original.tar d62 1 a62 1 tar -czf - --format pax @@- d65 1 a65 1 format archive on stdout. In this way, tar can be used to con‐ d68 1 a68 1 -a, --auto-compress d71 1 a71 1 tar -a -cf archive.tgz source.c source.h d74 1 a74 1 tar -a -cf archive.tar.bz2.uu source.c source.h d77 1 a77 1 tar -a -cf archive.zip source.c source.h d79 1 a79 1 tar -a -jcf archive.tgz source.c source.h d82 1 a82 1 tar -a -jcf archive.xxx source.c source.h d86 8 a93 1 -B, --read-full-blocks d96 1 a96 1 -b blocksize, --block-size blocksize d102 1 a102 1 -C directory, --cd directory, --directory directory d107 3 a109 3 --chroot (x mode only) chroot() to the current directory after processing any -C options and before extracting any files. d111 1 a111 1 --clear-nochange-fflags d116 1 a116 4 --disable-copyfile Mac OS X specific. Disable the use of copyfile(3). --exclude pattern d121 6 a126 1 --format format d135 1 a135 1 -f file, --file file d137 3 a139 3 The filename can be - for standard input or standard output. The default varies by system; on FreeBSD, the default is /dev/sa0; on Linux, the default is /dev/st0. d141 1 a141 1 --gid id d145 1 a145 1 if --gname is not also specified, the group name will be set to d148 1 a148 1 --gname name d152 1 a152 1 --gid option) will be used instead. On create, this sets the d156 3 a158 3 -H (c and r mode only) Symbolic links named on the command line will be followed; the target of the link will be archived, not the link itself. d160 1 a160 1 -h (c and r mode only) Synonym for -L. d162 1 a162 1 -I Synonym for -T. d164 1 a164 1 --help Show usage. d166 2 a167 2 --hfsCompression (x mode only) Mac OS X specific(v10.6 or later). Compress d170 2 a171 2 --ignore-zeros An alias of --options read_concatenated_archives for compatibil‐ d174 1 a174 1 --include pattern d176 1 a176 1 tern. Note that exclusions specified with --exclude take prece‐ d178 1 a178 1 fied, all entries are processed by default. The --include option d181 3 a183 3 tar -c -f new.tar --include='*foo*' @@old.tgz creates a new archive new.tar containing only the entries from old.tgz containing the string ‘foo’. d185 1 a185 1 -J, --xz d188 1 a188 1 other tar implementations, this implementation recognizes XZ com‐ d191 1 a191 1 -j, --bzip, --bzip2, --bunzip2 d194 1 a194 1 other tar implementations, this implementation recognizes bzip2 d197 1 a197 1 -k, --keep-old-files d202 1 a202 1 --keep-newer-files d206 2 a207 2 -L, --dereference (c and r mode only) All symbolic links will be followed. Nor‐ d211 1 a211 1 -l, --check-links d215 1 a215 1 --lrzip d219 1 a219 1 --lz4 (c mode only) Compress the archive with lz4-compatible compres‐ d223 1 a223 1 --lzma (c mode only) Compress the resulting archive with the original d225 2 a226 2 chives should be created with --xz instead. Note that, unlike other tar implementations, this implementation recognizes LZMA d229 1 a229 1 --lzop (c mode only) Compress the resulting archive with lzop(1). In d232 1 a232 1 -m, --modification-time d236 8 a243 1 -n, --norecurse, --no-recursion d247 1 a247 1 --newer date d251 2 a252 2 --newer-mtime date (c, r, u modes only) Like --newer, except it compares mtime d255 1 a255 1 --newer-than file d259 2 a260 2 --newer-mtime-than file (c, r, u modes only) Like --newer-than, except it compares mtime d263 1 a263 1 --nodump d267 1 a267 1 --nopreserveHFSCompression d273 1 a273 1 --null (use with -I or -T) Filenames or patterns are separated by null d275 1 a275 1 names output by the -print0 option to find(1). d277 20 a296 1 --no-same-owner d298 1 a298 1 reverse of --same-owner and the default behavior if tar is run as d301 1 a301 1 --no-same-permissions d304 8 a311 2 the reverse of -p and the default behavior if tar is run as non- root. d313 2 a314 2 --numeric-owner This is equivalent to --uname "" --gname "". On extract, it d319 1 a319 1 -O, --to-stdout d325 1 a325 1 -o (x mode) Use the user and group of the user running the program d327 1 a327 1 no significance unless -p is specified, and the program is being d332 1 a332 1 -o (c, r, u mode) A synonym for --format ustar d334 1 a334 1 --older date d338 2 a339 2 --older-mtime date (c, r, u modes only) Like --older, except it compares mtime d342 1 a342 1 --older-than file d346 2 a347 2 --older-mtime-than file (c, r, u modes only) Like --older-than, except it compares mtime d350 1 a350 1 --one-file-system d353 1 a353 1 --options options d359 1 a359 1 key=value d363 3 a365 3 key The key will be enabled in every module that supports it. This is equivalent to key=1. !key The key will be disabled in every module that supports d367 1 a367 1 module:key=value, module:key, module:!key d369 1 a369 1 provided only to modules whose name matches module. d371 1 a371 1 iso9660:joliet d373 2 a374 2 use !joliet or iso9660:!joliet to disable. iso9660:rockridge d376 2 a377 2 default, use !rockridge or iso9660:!rockridge to disable. gzip:compression-level d380 1 a380 1 gzip:timestamp d382 3 a384 3 !timestamp or gzip:!timestamp to disable. lrzip:compression=type Use type as compression method. Supported values are d387 1 a387 1 lrzip:compression-level d390 1 a390 1 lz4:compression-level d393 1 a393 1 lz4:stream-checksum d395 2 a396 2 lz4:!stream-checksum to disable. lz4:block-checksum d398 1 a398 1 lz4:block-size d401 1 a401 1 lz4:block-dependence d404 1 a404 1 lzop:compression-level d407 1 a407 1 xz:compression-level d410 1 a410 1 mtree:keyword d413 3 a415 3 words include: cksum, device, flags, gid, gname, indent, link, md5, mode, nlink, rmd160, sha1, sha256, sha384, sha512, size, time, uid, uname. The default is equiva‐ d418 1 a418 1 mtree:all d420 4 a423 4 mtree:!all to disable all keywords. mtree:use-set Enable generation of /set lines in the output. mtree:indent d426 2 a427 2 zip:compression=type Use type as compression method. Supported values are d429 1 a429 1 zip:encryption d431 2 a432 2 zip:encryption=type Use type as encryption type. Supported values are d436 1 a436 1 read_concatenated_archives d441 1 a441 1 ble to the -i, --ignore-zeros option of GNU tar. d445 1 a445 1 -P, --absolute-paths d448 2 a449 2 when creating archives and extracting from them. Also, tar will refuse to extract archive entries whose pathnames contain .. or d453 1 a453 1 -p, --insecure, --preserve-permissions d455 6 a460 5 full permissions, including owner, file modes, file flags and ACLs, if available, for each item extracted from the archive. This is the default, if tar is being run by root and can be over‐ ridden by also specifying --no-same-owner and --no-same-permissions. d462 2 a463 2 --passphrase passphrase The passphrase is used to extract or create an encrypted archive. d468 2 a469 2 --posix (c, r, u mode only) Synonym for --format pax d471 1 a471 1 -q, --fast-read d480 1 a480 1 -S (x mode only) Extract files as sparse files. For every block on d484 4 a487 4 -s pattern Modify file or archive member names according to pattern. The pattern has the format /old/new/[ghHprRsS] where old is a basic regular expression, new is the replacement string of the matched d489 2 a490 2 ment is handled. If old is not matched, the pattern is skipped. Within new, ~ is substituted with the match, \1 to \9 with the d502 1 a502 1 The default is hrs which applies substitutions to all names. In d505 1 a505 1 --same-owner d507 1 a507 1 of --no-same-owner and the default behavior if tar is run as d510 1 a510 1 --strip-components count d516 4 a519 4 -T filename, --files-from filename In x or t mode, tar will read the list of names to be extracted from filename. In c mode, tar will read names to be archived from filename. The special name “-C” on a line by itself will d522 1 a522 1 unless --null is specified. Note that --null also disables the d525 1 a525 1 -n as well. d527 3 a529 3 --totals (c, r, u mode only) After archiving all files, print a summary to stderr. d531 1 a531 1 -U, --unlink, --unlink-first d535 1 a535 1 flag also causes tar to remove intervening directory symlinks d539 1 a539 1 --uid id d541 1 a541 1 archive. On create, if --uname is not also specified, the user d544 1 a544 1 --uname name d548 1 a548 1 or from the --uid option) will be used instead. On create, this d552 1 a552 1 --use-compress-program program d554 1 a554 1 program instead of using the builtin compression support. d556 2 a557 2 -v, --verbose Produce verbose output. In create and extract modes, tar will d559 2 a560 2 In list mode, tar will produce output similar to that of ls(1). An additional -v option will also provide ls-like details in cre‐ d563 2 a564 2 --version Print version of tar and libarchive, and exit. d566 1 a566 1 -w, --confirmation, --interactive d569 1 a569 1 -X filename, --exclude-from filename d571 6 a576 1 --exclude for more information about the handling of exclusions. d578 1 a578 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d580 1 a580 1 other tar implementations, this implementation recognizes bzip2 d583 1 a583 1 -Z, --compress, --uncompress d586 1 a586 1 unlike other tar implementations, this implementation recognizes d589 1 a589 1 -z, --gunzip, --gzip d592 1 a592 1 other tar implementations, this implementation recognizes gzip d595 2 a596 2 ENVIRONMENT The following environment variables affect the execution of tar: d600 1 a600 1 ers. The --options option overrides this. d604 1 a604 1 ers. The --options option overrides this. d608 2 a609 2 TAPE The default device. The -f option overrides this. Please see the description of the -f option above for more details. d614 2 a615 2 EXIT STATUS The tar utility exits 0 on success, and >0 if an error occurs. d617 4 a620 4 EXAMPLES The following creates a new archive called file.tar.gz that contains two files source.c and source.h: tar -czf file.tar.gz source.c source.h d623 1 a623 1 tar -tvf file.tar.gz d626 1 a626 1 tar -x d629 1 a629 1 tar -tf image.iso d631 2 a632 2 To move file hierarchies, invoke tar as tar -cf - -C srcdir . | tar -xpf - -C destdir d634 1 a634 1 cd srcdir ; tar -cf - . | (cd destdir ; tar -xpf -) d637 4 a640 4 include directory change instructions of the form -Cfoo/baz and archive inclusions of the form @@archive-file. For example, the command line tar -c -f new.tar foo1 @@old.tgz -C/tmp foo2 will create a new archive new.tar. tar will read the file foo1 from the d642 2 a643 2 each entry from old.tgz and add those entries to the output archive. Finally, it will switch to the /tmp directory and add foo2 to the output d656 1 a656 1 The --newer and --newer-mtime switches accept a variety of common date d660 1 a660 1 The --options argument can be used to control various details of archive d662 2 a663 2 only contains type, time, and uid keywords: tar -cf file.tar --format=mtree --options='!all,type,time,uid' dir d665 3 a667 3 tar -czf file.tar --options='compression-level=9'. For more details, see the explanation of the archive_read_set_options() and archive_write_set_options() API calls that are described in d670 1 a670 1 COMPATIBILITY d676 4 a679 4 tar tbf 32 file.tar specifies three flags t, b, and f. The b and f flags both require argu‐ ments, so there must be two additional items on the command line. The 32 is the argument to the b flag, and file.tar is the argument to the f d685 3 a687 3 For maximum portability, scripts that invoke tar should use the bundled- argument format above, should limit themselves to the c, t, and x modes, and the b, f, m, v, and w options. d692 1 a692 1 SECURITY d694 1 a694 1 tar. In particular, carefully-crafted archives can request that tar d699 1 a699 1 three ways this can happen. Although tar has mechanisms to protect d702 2 a703 2 · Archive entries can have absolute pathnames. By default, tar removes the leading / character from filenames before restoring d706 2 a707 2 · Archive entries can have pathnames that include .. components. By default, tar will not extract files containing .. components d710 1 a710 1 · Archive entries can exploit symbolic links to restore files to d713 1 a713 1 directory. To guard against this, tar checks each extracted path d715 1 a715 1 removed and replaced with the archive entry. If -U is specified, d717 1 a717 1 If neither -U nor -P is specified, tar will refuse to extract the d721 3 a723 3 tar -tf filename before extraction. You should use the -k option to ensure that tar will not overwrite any existing files or the -U option to remove any pre- d725 1 a725 1 with super-user privileges. Note that the -P option to tar disables the d727 1 a727 1 ing any absolute pathnames, .. components, or symlinks to other directo‐ d730 1 a730 1 SEE ALSO d734 1 a734 1 STANDARDS d744 2 a745 2 HISTORY A tar command appeared in Seventh Edition Unix, which was released in d747 1 a747 1 which extended the file format. John Gilmore's pdtar public-domain d755 1 a755 1 BUGS d757 2 a758 2 of the -l option. Note that GNU tar prior to version 1.15 treated -l as a synonym for the --one-file-system option. d760 1 a760 1 The -C dir option may differ from historic implementations. d770 1 a770 1 when decompressing an archive created by tar, although they still extract d775 1 a775 1 tar -czf - file d777 1 a777 1 tar -cf - file | gzip d782 3 a784 3 The r and u modes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using c mode with the @@archive-file extension. d786 2 a787 2 To archive a file called @@foo or -foo you must specify it as ./@@foo or ./-foo, respectively. d789 2 a790 2 In create mode, a leading ./ is always removed. A leading / is stripped unless the -P option is specified. d798 1 a798 1 using the @@- convention can cause hard link information to be lost. d802 1 a802 1 BSD September 16, 2014 BSD @ 1.2 log @Changes 3.1.2: This is a maintenance update to fix issues with the new RAR seeking feature. This new release also contains fixes for build failures when building libarchive using Visual Studio 2012 and MinGW. @ text @d104 5 d161 4 d210 4 d349 14 d388 13 d420 6 d518 2 a519 1 Additional -v options will provide additional detail. d748 1 a748 2 There is not yet any support for multi-volume archives or for archiving sparse files. d755 1 a755 1 BSD November 1, 2012 BSD @ 1.1 log @Initial revision @ text @d1 1 a1 1 BSDTAR(1) FreeBSD General Commands Manual BSDTAR(1) d4 1 a4 1 tar -- manipulate tape archives d7 1 a7 1 tar [bundled-flags ] [ | ...] d14 3 a16 2 can extract from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, and shar archives. d18 2 a19 2 The first synopsis form shows a ``bundled'' option word. This usage is provided for compatibility with historical implementations. See COMPATI- d24 2 a25 1 -c Create a new archive containing the specified items. d28 3 a30 3 The -f option is required. -t List archive contents to stdout. -u Like -r, but new entries are added only if they have a modifica- d32 3 a34 2 Note that this only works on uncompressed archives stored in reg- ular files. The -f option is required. d38 1 a38 1 copies. d41 1 a41 1 archive in the order specified on the command line. By default, the con- d50 1 a50 1 Unless specifically stated otherwise, options are applicable in all oper- d55 1 a55 1 entries in it will be appended to the current archive. As a sim- d63 1 a63 1 reads an archive from standard input (whose format will be deter- d65 1 a65 1 format archive on stdout. In this way, tar can be used to con- d68 22 a89 1 -b blocksize d95 1 a95 1 -C directory d100 6 a105 3 --check-links (-W check-links) (c and r modes only) Issue a warning message unless all links to each file are archived. d107 2 a108 2 --exclude pattern (-W exclude=pattern) Do not process files or directories that match the specified pat- d112 8 a119 6 --format format (-W format=format) (c mode only) Use the specified format for the created archive. Supported formats include ``cpio'', ``pax'', ``shar'', and ``ustar''. Other formats may also be supported; see libarchive-formats(5) for more information about currently-sup- ported formats. d121 1 a121 1 -f file d123 18 a140 12 The filename can be - for standard input or standard output. If not specified, the default tape device will be used. (On FreeBSD, the default tape device is /dev/sa0.) --fast-read (-W fast-read) (x and t mode only) Extract or list only the first archive entry that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a performance optimization. d150 10 a159 4 --include pattern (-W include=pattern) Process only files or directories that match the specified pat- tern. Note that exclusions specified with --exclude take prece- dence over inclusions. If no inclusions are explicitly speci- d165 7 a171 1 old.tgz containing the string `foo'. d173 2 a174 1 -j (c mode only) Compress the resulting archive with bzip2(1). In d179 2 a180 1 -k (x mode only) Do not overwrite existing files. In particular, if d184 6 a189 1 -L (c and r mode only) All symbolic links will be followed. Nor- d193 16 a208 4 -l If POSIXLY_CORRECT is specified in the environment, this is a synonym for the --check-links option. Otherwise, an error will be displayed. Users who desire behavior compatible with GNU tar should use the --one-file-system option instead. d210 2 a211 1 -m (x mode only) Do not extract modification time. By default, the d214 2 a215 1 -n (c, r, u modes only) Do not recursively archive the contents of d218 1 a218 1 --newer date (-W newer=date) d222 1 a222 1 --newer-mtime date (-W newer-mtime=date) d226 1 a226 1 --newer-than file (-W newer-than=file) d230 1 a230 1 --newer-mtime-than file (-W newer-mtime-than=file) d234 1 a234 1 --nodump (-W nodump) d238 26 a263 4 --null (-W null) (use with -I, -T, or -X) Filenames or patterns are separated by null characters, not by newlines. This is often used to read filenames output by the -print0 option to find(1). d265 2 a266 1 -O (x, t modes only) In extract (-x) mode, files will be written to d271 20 a290 6 -o (x mode only) Use the user and group of the user running the pro- gram rather than those specified in the archive. Note that this has no significance unless -p is specified, and the program is being run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner infor- mation in the archive will be discarded. d292 5 a296 1 --one-file-system (-W one-file-system) d299 67 a365 1 -P Preserve pathnames. By default, absolute pathnames (those that d372 2 a373 1 -p (x mode only) Preserve file permissions. Attempt to restore the d375 4 a378 12 ACLs, if available, for each item extracted from the archive. By default, newly-created files are owned by the user running tar, the file mode is restored for newly-created regular files, and all other types of entries receive default permissions. If tar is being run by root, the default is to restore the owner unless the -o option is also specified. --strip-components count (-W strip-components=count) (x and t mode only) Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after checking inclu- sion/exclusion patterns but before security checks. d380 49 a428 1 -T filename d431 2 a432 2 from filename. The special name ``-C'' on a line by itself will cause the current directory to be changed to the directory speci- d435 28 a462 7 special handling of lines containing ``-C''. -U (x mode only) Unlink files before creating them. Without this option, tar overwrites existing files, which preserves existing hardlinks. With this option, existing hardlinks will be broken, as will any symlink that would affect the location of an extracted file. d468 2 a469 1 -v Produce verbose output. In create and extract modes, tar will d474 2 a475 5 -W longopt=value Long options (preceded by --) are only supported directly on sys- tems that have the getopt_long(3) function. The -W option can be used to access long options on systems that do not support this function. d477 2 a478 1 -w Ask for confirmation for every action. d480 1 a480 1 -X filename d489 8 a496 1 -z (c mode only) Compress the resulting archive with gzip(1). In d504 8 d514 2 a515 6 POSIXLY_CORRECT If this environment variable is defined, the -l option will be interpreted in accordance with ISO/IEC 9945-1:1996 (``POSIX.1''). TAPE The default tape device. The -f option overrides this. a519 4 FILES /dev/sa0 The default tape device, if not overridden by the TAPE envi- ronment variable or the -f option. d552 10 d563 12 a574 2 and time specifications, including ``12 Mar 2005 7:14:29pm'', ``2005-03-12 19:14'', ``5 minutes ago'', and ``19:14 PST May 1''. d578 1 a578 1 implementations. It consists of an initial word (with no leading - char- d583 1 a583 1 specifies three flags t, b, and f. The b and f flags both require argu- d595 2 a596 2 On systems that support getopt_long(), additional long options are avail- able to improve compatibility with other tar implementations. d603 1 a603 1 not intend to overwrite. If the archive is being extracted by the supe- d608 1 a608 1 o Archive entries can have absolute pathnames. By default, tar d612 1 a612 1 o Archive entries can have pathnames that include .. components. d616 1 a616 1 o Archive entries can exploit symbolic links to restore files to d632 2 a633 2 security checks above and allows you to extract an archive while preserv- ing any absolute pathnames, .. components, or symlinks to other directo- d637 2 a638 2 bzip2(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), libarchive(3), libarchive-formats(5), tar(5) d642 4 a645 5 ISO/IEC 9945-1:1996 (``POSIX.1'') but was dropped from IEEE Std 1003.1-2001 (``POSIX.1''). The options used by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX specifica- tion for pax. d648 1 a648 1 1003.1-2001 (``POSIX.1'') for the pax command. d659 1 d662 3 a664 4 POSIX and GNU violently disagree about the meaning of the -l option. Because of the potential for disaster if someone expects one behavior and gets the other, the -l option is deliberately broken in this implementa- tion. d668 1 a668 1 All archive output is written in correctly-sized blocks, even if the out- d674 1 a674 1 written to a regular file, the last block will not be padded. Many com- d709 1 a709 4 There are alternative long options for many of the short options that are deliberately not documented. FreeBSD 6.0 April 13, 2004 FreeBSD 6.0 @ 1.1.1.1 log @Import libarchive-2.4.0 @ text @@ 1.1.1.2 log @Import libarchive 2.8.0: - Infrastructure: - Allow command line tools as fallback for missing compression libraries. If compiled without gzip for example, gunzip will be used automatically. - Improved support for a number of platforms like high-resolution timestamps and Extended Attributes on various Unix systems - New convience interface for creating archives based on disk content, complement of the archive_write_disk interface. - Frontends: - bsdcpio ready for public consumption - hand-written date parser replaces the yacc code - Filter system: - Simplified read filter chains - Option support for filters - LZMA, XZ, uudecode handled - Format support: - Write support for mtree files based on file system or archive content - Basic read support for Joliet - Write support for zip files - Write support for shar archives, both text-only and binary-safe @ text @d76 1 a76 1 --check-links d80 1 a80 5 --chroot (x mode only) chroot() to the current directory after processing any -C options and before extracting any files. --exclude pattern d85 4 a88 4 --format format (c, r, u mode only) Use the specified format for the created ar- chive. Supported formats include ``cpio'', ``pax'', ``shar'', and ``ustar''. Other formats may also be supported; see d90 1 a90 3 ported formats. In r and u modes, when extending an existing ar- chive, the format specified here must be compatible with the for- mat of the existing archive on disk. d98 9 d115 1 a115 1 --include pattern a134 4 --keep-newer-files (x mode only) Do not overwrite existing files that are newer than the versions appearing in the archive being extracted. d139 4 a142 1 -l This is a synonym for the --check-links option. d150 1 a150 1 --newer date d154 1 a154 1 --newer-mtime date d158 1 a158 1 --newer-than file d162 1 a162 1 --newer-mtime-than file d166 1 a166 1 --nodump d170 2 a171 1 --null (use with -I, -T, or -X) Filenames or patterns are separated by a174 4 --numeric-owner (x mode only) Ignore symbolic user and group names when restoring archives to disk, only numeric uid and gid values will be obeyed. d180 6 a185 8 -o (x mode) Use the user and group of the user running the program rather than those specified in the archive. Note that this has no significance unless -p is specified, and the program is being run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner information in the archive will be discarded. -o (c, r, u mode) A synonym for --format ustar d187 1 a187 1 --one-file-system a189 52 --options options Select optional behaviors for particular modules. The argument is a text string containing comma-separated keywords and values. These are passed to the modules that handle particular formats to control how those formats will behave. Each option has one of the following forms: key=value The key will be set to the specified value in every mod- ule that supports it. Modules that do not support this key will ignore it. key The key will be enabled in every module that supports it. This is equivalent to key=1. !key The key will be disabled in every module that supports it. module:key=value, module:key, module:!key As above, but the corresponding key and value will be provided only to modules whose name matches module. The currently supported modules and keys are: iso9660:joliet Support Joliet extensions. This is enabled by default, use !joliet or iso9660:!joliet to disable. iso9660:rockridge Support Rock Ridge extensions. This is enabled by default, use !rockridge or iso9660:!rockridge to disable. gzip:compression-level A decimal integer from 0 to 9 specifying the gzip com- pression level. xz:compression-level A decimal integer from 0 to 9 specifying the xz compres- sion level. mtree:keyword The mtree writer module allows you to specify which mtree keywords will be included in the output. Supported key- words include: cksum, device, flags, gid, gname, indent, link, md5, mode, nlink, rmd160, sha1, sha256, sha384, sha512, size, time, uid, uname. The default is equiva- lent to: ``device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname''. mtree:all Enables all of the above keywords. You can also use mtree:!all to disable all keywords. mtree:use-set Enable generation of /set lines in the output. mtree:indent Produce human-readable output by indenting options and splitting lines to fit into 80 columns. zip:compression=type Use type as compression method. Supported values are store (uncompressed) and deflate (gzip algorithm). If a provided option is not supported by any module, that is a fatal error. d206 5 a210 33 -q (--fast-read) (x and t mode only) Extract or list only the first archive entry that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a performance optimization. -S (x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similiar to the conv=sparse option of dd. --strip-components count (x mode only) Remove the specified number of leading path ele- ments. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclu- sion patterns but before security checks. -s pattern Modify file or archive member names according to pattern. The pattern has the format /old/new/[gps] where old is a basic regu- lar expression, new is the replacement string of the matched part, and the optional trailing letters modify how the replace- ment is handled. If old is not matched, the pattern is skipped. Within new, ~ is substituted with the match, 1 to 9 with the con- tent of the corresponding captured group. The optional trailing g specifies that matching should continue after the matched part and stopped on the first unmatched pattern. The optional trail- ing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies that after a successful substitution the original path name and the new path name should be printed to standard error. d236 5 a240 2 --version Print version of tar and libarchive, and exit. a257 5 -Z (c mode only) Compress the resulting archive with compress(1). In extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes compress compression automatically when reading archives. d263 5 a308 10 An input file in mtree(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ from existing data on disk: $ cat input.mtree #mtree usr/bin uid=0 gid=0 mode=0755 type=dir usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls $ tar -cvf output.tar @@input.mtree a312 10 The --options argument can be used to control various details of archive generation or reading. For example, you can generate mtree output which only contains type, time, and uid keywords: tar -cf file.tar --format=mtree --options='!all,type,time,uid' dir or you can set the compression level used by gzip or xz compression: tar -czf file.tar --options='compression-level=9'. For more details, see the explanation of the archive_read_set_options() and archive_write_set_options() API calls that are described in archive_read(3) and archive_write(3). d332 2 a333 2 Additional long options are provided to improve compatibility with other tar implementations. d374 2 a375 2 bzip2(1), compress(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), libarchive(3), libarchive-formats(5), tar(5) d399 4 a402 3 This program follows ISO/IEC 9945-1:1996 (``POSIX.1'') for the definition of the -l option. Note that GNU tar prior to version 1.15 treated -l as a synonym for the --one-file-system option. d450 1 a450 1 FreeBSD 8.0 Oct 12, 2009 FreeBSD 8.0 @ 1.1.1.3 log @libarchive-2.8.2: - Fix NULL deference for short self-extracting zip archives - Don't dereference symlinks on Linux when reading ACLs - Better detection of SHA2 support for old OpenSSL versions - Fix parsing of input files for bsdtar -T - Do not leak setup_xattr into the global namespace - Fix build when an older libarchive is already installed - Use O_BINARY opening files in bsdtar - Include missing archive_crc32.h - Correctly include iconv.h required by libxml2 @ text @d1 1 a1 1 BSDTAR(1) NetBSD General Commands Manual BSDTAR(1) d21 1 a21 1 The other synopsis forms show the preferred usage. The first option to d23 2 a24 2 -c Create a new archive containing the specified items. -r Like -c, but new entries are appended to the archive. Note that d27 2 a28 2 -t List archive contents to stdout. -u Like -r, but new entries are added only if they have a modifica- d32 1 a32 1 -x Extract to disk from the archive. If a file with the same name d104 1 a104 1 -H (c and r mode only) Symbolic links named on the command line will d108 1 a108 1 -h (c and r mode only) Synonym for -L. d110 1 a110 1 -I Synonym for -T. d123 1 a123 1 -j (c mode only) Compress the resulting archive with bzip2(1). In d128 1 a128 1 -k (x mode only) Do not overwrite existing files. In particular, if d136 1 a136 1 -L (c and r mode only) All symbolic links will be followed. Nor- d140 1 a140 1 -l This is a synonym for the --check-links option. d142 1 a142 1 -m (x mode only) Do not extract modification time. By default, the d145 1 a145 1 -n (c, r, u modes only) Do not recursively archive the contents of d176 1 a176 1 -O (x, t modes only) In extract (-x) mode, files will be written to d181 1 a181 1 -o (x mode) Use the user and group of the user running the program d188 1 a188 1 -o (c, r, u mode) A synonym for --format ustar d212 1 a212 1 Support Joliet extensions. This is enabled by default, d232 1 a232 1 Enables all of the above keywords. You can also use d245 1 a245 1 -P Preserve pathnames. By default, absolute pathnames (those that d252 1 a252 1 -p (x mode only) Preserve file permissions. Attempt to restore the d267 1 a267 1 entries overwrite earlier entries. This option is provided as a d270 1 a270 1 -S (x mode only) Extract files as sparse files. For every block on d272 1 a272 1 otherwise. This works similiar to the conv=sparse option of dd. d304 1 a304 1 -U (x mode only) Unlink files before creating them. Without this d306 1 a306 1 hardlinks. With this option, existing hardlinks will be broken, d314 1 a314 1 -v Produce verbose output. In create and extract modes, tar will d322 1 a322 1 -w Ask for confirmation for every action. d325 1 a325 1 Read a list of exclusion patterns from the specified file. See d328 1 a328 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d333 1 a333 1 -z (c mode only) Compress the resulting archive with gzip(1). In d338 1 a338 1 -Z (c mode only) Compress the resulting archive with compress(1). d350 1 a350 1 TZ The timezone to use when displaying dates. See environ(7) for d383 1 a383 1 will create a new archive new.tar. tar will read the file foo1 from the d420 1 a420 1 specifies three flags t, b, and f. The b and f flags both require argu- d445 1 a445 1 Archive entries can have absolute pathnames. By default, tar d449 1 a449 1 Archive entries can have pathnames that include .. components. d453 2 a454 2 Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to d456 1 a456 1 directory. To guard against this, tar checks each extracted path d463 1 a463 1 untrusted sources. You should examine the contents of an archive with d465 1 a465 1 before extraction. You should use the -k option to ensure that tar will d480 1 a480 1 1003.1-2001 (``POSIX.1''). The options used by this implementation were d549 1 a549 1 NetBSD 5.0 Oct 12, 2009 NetBSD 5.0 @ 1.1.1.4 log @libarchive-2.8.3: Build fix for Linux @ text @d1 1 a1 1 BSDTAR(1) FreeBSD General Commands Manual BSDTAR(1) d21 1 a21 1 The other synopsis forms show the preferred usage. The first option to d23 2 a24 2 -c Create a new archive containing the specified items. -r Like -c, but new entries are appended to the archive. Note that d27 2 a28 2 -t List archive contents to stdout. -u Like -r, but new entries are added only if they have a modifica- d32 1 a32 1 -x Extract to disk from the archive. If a file with the same name d104 1 a104 1 -H (c and r mode only) Symbolic links named on the command line will d108 1 a108 1 -h (c and r mode only) Synonym for -L. d110 1 a110 1 -I Synonym for -T. d123 1 a123 1 -j (c mode only) Compress the resulting archive with bzip2(1). In d128 1 a128 1 -k (x mode only) Do not overwrite existing files. In particular, if d136 1 a136 1 -L (c and r mode only) All symbolic links will be followed. Nor- d140 1 a140 1 -l This is a synonym for the --check-links option. d142 1 a142 1 -m (x mode only) Do not extract modification time. By default, the d145 1 a145 1 -n (c, r, u modes only) Do not recursively archive the contents of d176 1 a176 1 -O (x, t modes only) In extract (-x) mode, files will be written to d181 1 a181 1 -o (x mode) Use the user and group of the user running the program d188 1 a188 1 -o (c, r, u mode) A synonym for --format ustar d212 1 a212 1 Support Joliet extensions. This is enabled by default, d232 1 a232 1 Enables all of the above keywords. You can also use d245 1 a245 1 -P Preserve pathnames. By default, absolute pathnames (those that d252 1 a252 1 -p (x mode only) Preserve file permissions. Attempt to restore the d267 1 a267 1 entries overwrite earlier entries. This option is provided as a d270 1 a270 1 -S (x mode only) Extract files as sparse files. For every block on d272 1 a272 1 otherwise. This works similiar to the conv=sparse option of dd. d304 1 a304 1 -U (x mode only) Unlink files before creating them. Without this d306 1 a306 1 hardlinks. With this option, existing hardlinks will be broken, d314 1 a314 1 -v Produce verbose output. In create and extract modes, tar will d322 1 a322 1 -w Ask for confirmation for every action. d325 1 a325 1 Read a list of exclusion patterns from the specified file. See d328 1 a328 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d333 1 a333 1 -z (c mode only) Compress the resulting archive with gzip(1). In d338 1 a338 1 -Z (c mode only) Compress the resulting archive with compress(1). d350 1 a350 1 TZ The timezone to use when displaying dates. See environ(7) for d383 1 a383 1 will create a new archive new.tar. tar will read the file foo1 from the d420 1 a420 1 specifies three flags t, b, and f. The b and f flags both require argu- d445 1 a445 1 o Archive entries can have absolute pathnames. By default, tar d449 1 a449 1 o Archive entries can have pathnames that include .. components. d453 2 a454 2 o Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to d456 1 a456 1 directory. To guard against this, tar checks each extracted path d463 1 a463 1 untrusted sources. You should examine the contents of an archive with d465 1 a465 1 before extraction. You should use the -k option to ensure that tar will d480 1 a480 1 1003.1-2001 (``POSIX.1''). The options used by this implementation were d549 1 a549 1 FreeBSD 9.0 Oct 12, 2009 FreeBSD 9.0 @ 1.1.1.5 log @Import libarchive-2.8.4: - Improved reliability of hash function detection - Fix issues on ancient FreeBSD, QNX, ancient NetBSD and Minix @ text @d1 1 a1 1 BSDTAR(1) NetBSD General Commands Manual BSDTAR(1) d21 1 a21 1 The other synopsis forms show the preferred usage. The first option to d23 2 a24 2 -c Create a new archive containing the specified items. -r Like -c, but new entries are appended to the archive. Note that d27 2 a28 2 -t List archive contents to stdout. -u Like -r, but new entries are added only if they have a modifica- d32 1 a32 1 -x Extract to disk from the archive. If a file with the same name d104 1 a104 1 -H (c and r mode only) Symbolic links named on the command line will d108 1 a108 1 -h (c and r mode only) Synonym for -L. d110 1 a110 1 -I Synonym for -T. d123 1 a123 1 -j (c mode only) Compress the resulting archive with bzip2(1). In d128 1 a128 1 -k (x mode only) Do not overwrite existing files. In particular, if d136 1 a136 1 -L (c and r mode only) All symbolic links will be followed. Nor- d140 1 a140 1 -l This is a synonym for the --check-links option. d142 1 a142 1 -m (x mode only) Do not extract modification time. By default, the d145 1 a145 1 -n (c, r, u modes only) Do not recursively archive the contents of d176 1 a176 1 -O (x, t modes only) In extract (-x) mode, files will be written to d181 1 a181 1 -o (x mode) Use the user and group of the user running the program d188 1 a188 1 -o (c, r, u mode) A synonym for --format ustar d212 1 a212 1 Support Joliet extensions. This is enabled by default, d232 1 a232 1 Enables all of the above keywords. You can also use d245 1 a245 1 -P Preserve pathnames. By default, absolute pathnames (those that d252 1 a252 1 -p (x mode only) Preserve file permissions. Attempt to restore the d267 1 a267 1 entries overwrite earlier entries. This option is provided as a d270 1 a270 1 -S (x mode only) Extract files as sparse files. For every block on d272 1 a272 1 otherwise. This works similiar to the conv=sparse option of dd. d286 8 a293 8 Within new, ~ is substituted with the match, \1 to \9 with the content of the corresponding captured group. The optional trail- ing g specifies that matching should continue after the matched part and stopped on the first unmatched pattern. The optional trailing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies that after a successful substitution the original path name and the new path name should be printed to standard error. d304 1 a304 1 -U (x mode only) Unlink files before creating them. Without this d306 1 a306 1 hardlinks. With this option, existing hardlinks will be broken, d314 1 a314 1 -v Produce verbose output. In create and extract modes, tar will d322 1 a322 1 -w Ask for confirmation for every action. d325 1 a325 1 Read a list of exclusion patterns from the specified file. See d328 1 a328 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d333 1 a333 1 -z (c mode only) Compress the resulting archive with gzip(1). In d338 1 a338 1 -Z (c mode only) Compress the resulting archive with compress(1). a342 3 EXIT STATUS The tar utility exits 0 on success, and >0 if an error occurs. d350 1 a350 1 TZ The timezone to use when displaying dates. See environ(7) for d357 3 d383 1 a383 1 will create a new archive new.tar. tar will read the file foo1 from the d420 1 a420 1 specifies three flags t, b, and f. The b and f flags both require argu- d445 1 a445 1 Archive entries can have absolute pathnames. By default, tar d449 1 a449 1 Archive entries can have pathnames that include .. components. d453 2 a454 2 Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to d456 1 a456 1 directory. To guard against this, tar checks each extracted path d463 1 a463 1 untrusted sources. You should examine the contents of an archive with d465 1 a465 1 before extraction. You should use the -k option to ensure that tar will d480 1 a480 1 1003.1-2001 (``POSIX.1''). The options used by this implementation were d549 1 a549 1 NetBSD 5.0 Oct 12, 2009 NetBSD 5.0 @ 1.1.1.6 log @Import libarchive-3.2.1: - security fixes and other bugfixes - support for multhreading in xz 5.2+ @ text @d1 1 a1 1 TAR(1) BSD General Commands Manual TAR(1) d4 1 a4 1 tar — manipulate tape archives d7 1 a7 1 tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...] d14 2 a15 3 can extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives. d17 2 a18 2 The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See COMPATI‐ d21 1 a21 1 The other synopsis forms show the preferred usage. The first option to d23 2 a24 3 -c Create a new archive containing the specified items. The long option form is --create. -r Like -c, but new entries are appended to the archive. Note that d26 3 a28 3 The -f option is required. The long option form is --append. -t List archive contents to stdout. The long option form is --list. -u Like -r, but new entries are added only if they have a modifica‐ d30 3 a32 4 Note that this only works on uncompressed archives stored in reg‐ ular files. The -f option is required. The long form is --update. -x Extract to disk from the archive. If a file with the same name d35 1 a35 1 copies. The long option form is --extract. d38 1 a38 1 archive in the order specified on the command line. By default, the con‐ d47 1 a47 1 Unless specifically stated otherwise, options are applicable in all oper‐ d52 1 a52 1 entries in it will be appended to the current archive. As a sim‐ d60 1 a60 1 reads an archive from standard input (whose format will be deter‐ d62 1 a62 1 format archive on stdout. In this way, tar can be used to con‐ d65 1 a65 22 -a, --auto-compress (c mode only) Use the archive suffix to decide a set of the for‐ mat and the compressions. As a simple example, tar -a -cf archive.tgz source.c source.h creates a new archive with restricted pax format and gzip com‐ pression, tar -a -cf archive.tar.bz2.uu source.c source.h creates a new archive with restricted pax format and bzip2 com‐ pression and uuencode compression, tar -a -cf archive.zip source.c source.h creates a new archive with zip format, tar -a -jcf archive.tgz source.c source.h ignores the “-j” option, and creates a new archive with restricted pax format and gzip compression, tar -a -jcf archive.xxx source.c source.h if it is unknown suffix or no suffix, creates a new archive with restricted pax format and bzip2 compression. -B, --read-full-blocks Ignored for compatibility with other tar(1) implementations. -b blocksize, --block-size blocksize d71 1 a71 1 -C directory, --cd directory, --directory directory d76 4 a83 8 --clear-nochange-fflags (x mode only) Before removing file system objects to replace them, clear platform-specific file flags that might prevent removal. --disable-copyfile Mac OS X specific. Disable the use of copyfile(3). d85 1 a85 1 Do not process files or directories that match the specified pat‐ d90 6 a95 6 (c, r, u mode only) Use the specified format for the created ar‐ chive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see libarchive-formats(5) for more information about currently-sup‐ ported formats. In r and u modes, when extending an existing ar‐ chive, the format specified here must be compatible with the for‐ d98 1 a98 1 -f file, --file file d100 3 a102 18 The filename can be - for standard input or standard output. The default varies by system; on FreeBSD, the default is /dev/sa0; on Linux, the default is /dev/st0. --gid id Use the provided group id number. On extract, this overrides the group id in the archive; the group name in the archive will be ignored. On create, this overrides the group id read from disk; if --gname is not also specified, the group name will be set to match the group id. --gname name Use the provided group name. On extract, this overrides the group name in the archive; if the provided group name does not exist on the system, the group id (from the archive or from the --gid option) will be used instead. On create, this sets the group name that will be stored in the archive; the name will not be verified against the system group database. d104 1 a104 1 -H (c and r mode only) Symbolic links named on the command line will d108 1 a108 5 -h (c and r mode only) Synonym for -L. -I Synonym for -T. --help Show usage. d110 1 a110 7 --hfsCompression (x mode only) Mac OS X specific(v10.6 or later). Compress extracted regular files with HFS+ compression. --ignore-zeros An alias of --options read_concatenated_archives for compatibil‐ ity with GNU tar. d113 3 a115 3 Process only files or directories that match the specified pat‐ tern. Note that exclusions specified with --exclude take prece‐ dence over inclusions. If no inclusions are explicitly speci‐ d121 1 a121 7 old.tgz containing the string ‘foo’. -J, --xz (c mode only) Compress the resulting archive with xz(1). In extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes XZ com‐ pression automatically when reading archives. d123 1 a123 2 -j, --bzip, --bzip2, --bunzip2 (c mode only) Compress the resulting archive with bzip2(1). In d128 1 a128 2 -k, --keep-old-files (x mode only) Do not overwrite existing files. In particular, if d136 1 a136 2 -L, --dereference (c and r mode only) All symbolic links will be followed. Nor‐ d140 1 a140 20 -l, --check-links (c and r modes only) Issue a warning message unless all links to each file are archived. --lrzip (c mode only) Compress the resulting archive with lrzip(1). In extract or list modes, this option is ignored. --lz4 (c mode only) Compress the archive with lz4-compatible compres‐ sion before writing it. In input mode, this option is ignored; lz4 compression is recognized automatically on input. --lzma (c mode only) Compress the resulting archive with the original LZMA algorithm. Use of this option is discouraged and new ar‐ chives should be created with --xz instead. Note that, unlike other tar implementations, this implementation recognizes LZMA compression automatically when reading archives. --lzop (c mode only) Compress the resulting archive with lzop(1). In extract or list modes, this option is ignored. d142 1 a142 2 -m, --modification-time (x mode only) Do not extract modification time. By default, the d145 1 a145 2 -n, --norecurse, --no-recursion (c, r, u modes only) Do not recursively archive the contents of d168 3 a170 20 --nopreserveHFSCompression (x mode only) Mac OS X specific(v10.6 or later). Do not compress extracted regular files which were compressed with HFS+ compres‐ sion before archived. By default, compress the regular files again with HFS+ compression. --null (use with -I or -T) Filenames or patterns are separated by null characters, not by newlines. This is often used to read file‐ names output by the -print0 option to find(1). --no-same-owner (x mode only) Do not extract owner and group IDs. This is the reverse of --same-owner and the default behavior if tar is run as non-root. --no-same-permissions (x mode only) Do not extract full permissions (SGID, SUID, sticky bit, ACLs, extended attributes or extended file flags). This is the reverse of -p and the default behavior if tar is run as non- root. d173 2 a174 4 This is equivalent to --uname "" --gname "". On extract, it causes user and group names in the archive to be ignored in favor of the numeric user and group ids. On create, it causes user and group names to not be stored in the archive. d176 1 a176 2 -O, --to-stdout (x, t modes only) In extract (-x) mode, files will be written to d181 1 a181 1 -o (x mode) Use the user and group of the user running the program d188 1 a188 17 -o (c, r, u mode) A synonym for --format ustar --older date (c, r, u modes only) Only include files and directories older than the specified date. This compares ctime entries. --older-mtime date (c, r, u modes only) Like --older, except it compares mtime entries instead of ctime entries. --older-than file (c, r, u modes only) Only include files and directories older than the specified file. This compares ctime entries. --older-mtime-than file (c, r, u modes only) Like --older-than, except it compares mtime entries instead of ctime entries. d200 1 a200 1 The key will be set to the specified value in every mod‐ d212 1 a212 1 Support Joliet extensions. This is enabled by default, d218 1 a218 28 A decimal integer from 1 to 9 specifying the gzip com‐ pression level. gzip:timestamp Store timestamp. This is enabled by default, use !timestamp or gzip:!timestamp to disable. lrzip:compression=type Use type as compression method. Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, extremely slow). lrzip:compression-level A decimal integer from 1 to 9 specifying the lrzip com‐ pression level. lz4:compression-level A decimal integer from 1 to 9 specifying the lzop com‐ pression level. lz4:stream-checksum Enable stream checksum. This is by default, use lz4:!stream-checksum to disable. lz4:block-checksum Enable block checksum (Disabled by default). lz4:block-size A decimal integer from 4 to 7 specifying the lz4 compres‐ sion block size (7 is set by default). lz4:block-dependence Use the previous block of the block being compressed for a compression dictionary to improve compression ratio. lzop:compression-level A decimal integer from 1 to 9 specifying the lzop com‐ d221 1 a221 1 A decimal integer from 0 to 9 specifying the xz compres‐ d225 1 a225 1 keywords will be included in the output. Supported key‐ d228 3 a230 3 sha512, size, time, uid, uname. The default is equiva‐ lent to: “device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname”. d232 1 a232 1 Enables all of the above keywords. You can also use a241 13 zip:encryption Enable encryption using traditional zip encryption. zip:encryption=type Use type as encryption type. Supported values are zipcrypt (traditional zip encryption), aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ tion). read_concatenated_archives Ignore zeroed blocks in the archive, which occurs when multiple tar archives have been concatenated together. Without this option, only the contents of the first con‐ catenated archive would be read. This option is compara‐ ble to the -i, --ignore-zeros option of GNU tar. d245 1 a245 2 -P, --absolute-paths Preserve pathnames. By default, absolute pathnames (those that d252 1 a252 2 -p, --insecure, --preserve-permissions (x mode only) Preserve file permissions. Attempt to restore the d254 6 a259 13 ACLs, if available, for each item extracted from the archive. This is the default, if tar is being run by root and can be over‐ ridden by also specifying --no-same-owner and --no-same-permissions. --passphrase passphrase The passphrase is used to extract or create an encrypted archive. Currently, zip is the only supported format that supports encryp‐ tion. You shouldn't use this option unless you realize how inse‐ cure use of this option is. --posix (c, r, u mode only) Synonym for --format pax d261 1 a261 1 -q, --fast-read d267 1 a267 1 entries overwrite earlier entries. This option is provided as a d270 1 a270 1 -S (x mode only) Extract files as sparse files. For every block on d272 7 a278 1 otherwise. This works similar to the conv=sparse option of dd. d282 3 a284 3 pattern has the format /old/new/[ghHprRsS] where old is a basic regular expression, new is the replacement string of the matched part, and the optional trailing letters modify how the replace‐ d287 1 a287 1 content of the corresponding captured group. The optional trail‐ d289 1 a289 1 part and stop on the first unmatched pattern. The optional d293 1 a293 18 name should be printed to standard error. Optional trailing H, R, or S characters suppress substitutions for hardlink targets, regular filenames, or symlink targets, respectively. Optional trailing h, r, or s characters enable substitutions for hardlink targets, regular filenames, or symlink targets, respectively. The default is hrs which applies substitutions to all names. In particular, it is never necessary to specify h, r, or s. --same-owner (x mode only) Extract owner and group IDs. This is the reverse of --no-same-owner and the default behavior if tar is run as root. --strip-components count Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion patterns but before security checks. d295 1 a295 1 -T filename, --files-from filename d298 2 a299 2 from filename. The special name “-C” on a line by itself will cause the current directory to be changed to the directory speci‐ d302 7 a308 28 special handling of lines containing “-C”. Note: If you are generating lists of files using find(1), you probably want to use -n as well. --totals (c, r, u mode only) After archiving all files, print a summary to stderr. -U, --unlink, --unlink-first (x mode only) Unlink files before creating them. This can be a minor performance optimization if most files already exist, but can make things slower if most files do not already exist. This flag also causes tar to remove intervening directory symlinks instead of reporting an error. See the SECURITY section below for more details. --uid id Use the provided user id number and ignore the user name from the archive. On create, if --uname is not also specified, the user name will be set to match the user id. --uname name Use the provided user name. On extract, this overrides the user name in the archive; if the provided user name does not exist on the system, it will be ignored and the user id (from the archive or from the --uid option) will be used instead. On create, this sets the user name that will be stored in the archive; the name is not verified against the system user database. d314 1 a314 2 -v, --verbose Produce verbose output. In create and extract modes, tar will d317 1 a317 2 An additional -v option will also provide ls-like details in cre‐ ate and extract mode. d322 1 a322 2 -w, --confirmation, --interactive Ask for confirmation for every action. d324 2 a325 2 -X filename, --exclude-from filename Read a list of exclusion patterns from the specified file. See d328 1 a328 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d333 6 a338 2 -Z, --compress, --uncompress (c mode only) Compress the resulting archive with compress(1). d343 2 a344 5 -z, --gunzip, --gzip (c mode only) Compress the resulting archive with gzip(1). In extract or list modes, this option is ignored. Note that, unlike other tar implementations, this implementation recognizes gzip compression automatically when reading archives. a348 8 TAR_READER_OPTIONS The default options for format readers and compression read‐ ers. The --options option overrides this. TAR_WRITER_OPTIONS The default options for format writers and compression writ‐ ers. The --options option overrides this. d351 1 a351 2 TAPE The default device. The -f option overrides this. Please see the description of the -f option above for more details. d353 1 a353 1 TZ The timezone to use when displaying dates. See environ(7) for d356 3 a358 2 EXIT STATUS The tar utility exits 0 on success, and >0 if an error occurs. d383 1 a383 1 will create a new archive new.tar. tar will read the file foo1 from the d400 2 a401 2 and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12 19:14”, “5 minutes ago”, and “19:14 PST May 1”. d415 1 a415 1 implementations. It consists of an initial word (with no leading - char‐ d420 1 a420 1 specifies three flags t, b, and f. The b and f flags both require argu‐ d440 1 a440 1 not intend to overwrite. If the archive is being extracted by the supe‐ d445 1 a445 1 · Archive entries can have absolute pathnames. By default, tar d449 1 a449 1 · Archive entries can have pathnames that include .. components. d453 2 a454 2 · Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to d456 1 a456 1 directory. To guard against this, tar checks each extracted path d463 1 a463 1 untrusted sources. You should examine the contents of an archive with d465 1 a465 1 before extraction. You should use the -k option to ensure that tar will d469 2 a470 2 security checks above and allows you to extract an archive while preserv‐ ing any absolute pathnames, .. components, or symlinks to other directo‐ d474 1 a474 1 bzip2(1), compress(1), cpio(1), gzip(1), mt(1), pax(1), shar(1), xz(1), d479 5 a483 4 ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX specification for pax. d486 1 a486 1 1003.1-2001 (“POSIX.1”) for the pax command. a496 1 It was first released with FreeBSD 5.4 in May, 2005. d499 1 a499 1 This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition d505 1 a505 1 All archive output is written in correctly-sized blocks, even if the out‐ d511 1 a511 1 written to a regular file, the last block will not be padded. Many com‐ d538 2 a539 1 There is not yet any support for multi-volume archives. d546 4 a549 1 BSD September 16, 2014 BSD @ 1.1.1.7 log @Import libarchive-3.3.1. @ text @d3 2 a4 2 1mNAME0m 1mtar 22m— manipulate tape archives d6 5 a10 5 1mSYNOPSIS0m 1mtar 22m[4mbundled-flags24m ⟨args⟩] [⟨4mfile24m⟩ | ⟨4mpattern24m⟩ ...] 1mtar 22m{1m-c22m} [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-r 22m| 1m-u22m} 1m-f 4m22marchive-file24m [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-t 22m| 1m-x22m} [4moptions24m] [4mpatterns24m] d12 2 a13 2 1mDESCRIPTION0m 1mtar 22mcreates and manipulates streaming archive files. This implementation d23 4 a26 4 1mtar 22mis a mode indicator from the following list: 1m-c 22mCreate a new archive containing the specified items. The long option form is 1m--create22m. 1m-r 22mLike 1m-c22m, but new entries are appended to the archive. Note that d28 3 a30 3 The 1m-f 22moption is required. The long option form is 1m--append22m. 1m-t 22mList archive contents to stdout. The long option form is 1m--list22m. 1m-u 22mLike 1m-r22m, but new entries are added only if they have a modifica‐ d33 3 a35 3 ular files. The 1m-f 22moption is required. The long form is 1m--update22m. 1m-x 22mExtract to disk from the archive. If a file with the same name d38 1 a38 1 copies. The long option form is 1m--extract22m. d40 1 a40 1 In 1m-c22m, 1m-r22m, or 1m-u 22mmode, each specified file or directory is added to the d49 1 a49 1 1mOPTIONS0m d53 2 a54 2 1m@@4m22marchive0m (c and r modes only) The specified archive is opened and the d57 4 a60 4 1mtar -c -f 4m22m-24m 4mnewfile24m 1m@@4m22moriginal.tar0m writes a new archive to standard output containing a file 4mnewfile0m and all of the entries from 4moriginal.tar24m. In contrast, 1mtar -c -f 4m22m-24m 4mnewfile24m 4moriginal.tar0m d62 1 a62 1 1mtar -czf 4m22m-24m 1m--format pax @@4m22m-0m d65 1 a65 1 format archive on stdout. In this way, 1mtar 22mcan be used to con‐ d68 1 a68 1 1m-a22m, 1m--auto-compress0m d71 1 a71 1 1mtar -a -cf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m d74 1 a74 1 1mtar -a -cf 4m22marchive.tar.bz2.uu24m 4msource.c24m 4msource.h0m d77 1 a77 1 1mtar -a -cf 4m22marchive.zip24m 4msource.c24m 4msource.h0m d79 1 a79 1 1mtar -a -jcf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m d82 1 a82 1 1mtar -a -jcf 4m22marchive.xxx24m 4msource.c24m 4msource.h0m d86 1 a86 8 1m--acls 22m(c, r, u, x modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--no-acls 22mand the default behavior in c, r, and u modes (except Mac OS X) or if 1mtar 22mis run in x mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the 1m--mac-metadata 22moption is preferred. 1m-B22m, 1m--read-full-blocks0m d89 1 a89 1 1m-b 4m22mblocksize24m, 1m--block-size 4m22mblocksize0m d95 1 a95 1 1m-C 4m22mdirectory24m, 1m--cd 4m22mdirectory24m, 1m--directory 4m22mdirectory0m d100 3 a102 3 1m--chroot0m (x mode only) 1mchroot22m() to the current directory after processing any 1m-C 22moptions and before extracting any files. d104 1 a104 1 1m--clear-nochange-fflags0m d109 4 a112 1 1m--exclude 4m22mpattern0m d117 1 a117 6 1m--fflags0m (c, r, u, x modes only) Archive or extract file flags. This is the reverse of 1m--no-fflags 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. 1m--format 4m22mformat0m d126 1 a126 1 1m-f 4m22mfile24m, 1m--file 4m22mfile0m d128 3 a130 3 The filename can be 4m-24m for standard input or standard output. The default varies by system; on FreeBSD, the default is 4m/dev/sa024m; on Linux, the default is 4m/dev/st024m. d132 1 a132 1 1m--gid 4m22mid0m d136 1 a136 1 if 1m--gname 22mis not also specified, the group name will be set to d139 1 a139 1 1m--gname 4m22mname0m d143 1 a143 1 1m--gid 22moption) will be used instead. On create, this sets the d147 3 a149 3 1m-H 22m(c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not the link itself. d151 1 a151 1 1m-h 22m(c and r modes only) Synonym for 1m-L22m. d153 1 a153 1 1m-I 22mSynonym for 1m-T22m. d155 1 a155 1 1m--help 22mShow usage. d157 2 a158 2 1m--hfsCompression0m (x mode only) Mac OS X specific (v10.6 or later). Compress d161 2 a162 2 1m--ignore-zeros0m An alias of 1m--options read_concatenated_archives 22mfor compatibil‐ d165 1 a165 1 1m--include 4m22mpattern0m d167 1 a167 1 tern. Note that exclusions specified with 1m--exclude 22mtake prece‐ d169 1 a169 1 fied, all entries are processed by default. The 1m--include 22moption d172 3 a174 3 1mtar -c -f 4m22mnew.tar24m 1m--include='*foo*' @@4m22mold.tgz0m creates a new archive 4mnew.tar24m containing only the entries from 4mold.tgz24m containing the string ‘foo’. d176 1 a176 1 1m-J22m, 1m--xz0m d179 1 a179 1 other 1mtar 22mimplementations, this implementation recognizes XZ com‐ d182 1 a182 1 1m-j22m, 1m--bzip22m, 1m--bzip222m, 1m--bunzip20m d185 1 a185 1 other 1mtar 22mimplementations, this implementation recognizes bzip2 d188 1 a188 1 1m-k22m, 1m--keep-old-files0m d193 1 a193 1 1m--keep-newer-files0m d197 2 a198 2 1m-L22m, 1m--dereference0m (c and r modes only) All symbolic links will be followed. Nor‐ d202 1 a202 1 1m-l22m, 1m--check-links0m d206 1 a206 1 1m--lrzip0m d210 1 a210 1 1m--lz4 22m(c mode only) Compress the archive with lz4-compatible compres‐ d214 1 a214 1 1m--lzma 22m(c mode only) Compress the resulting archive with the original d216 2 a217 2 chives should be created with 1m--xz 22minstead. Note that, unlike other 1mtar 22mimplementations, this implementation recognizes LZMA d220 1 a220 1 1m--lzop 22m(c mode only) Compress the resulting archive with lzop(1). In d223 1 a223 1 1m-m22m, 1m--modification-time0m d227 1 a227 8 1m--mac-metadata0m (c, r, u and x mode only) Mac OS X specific. Archive or extract extended ACLs and extended attributes using copyfile(3) in Apple‐ Double format. This is the reverse of 1m--no-mac-metadata22m. and the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. 1m-n22m, 1m--norecurse22m, 1m--no-recursion0m d231 1 a231 1 1m--newer 4m22mdate0m d235 2 a236 2 1m--newer-mtime 4m22mdate0m (c, r, u modes only) Like 1m--newer22m, except it compares mtime d239 1 a239 1 1m--newer-than 4m22mfile0m d243 2 a244 2 1m--newer-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--newer-than22m, except it compares mtime d247 1 a247 1 1m--nodump0m d251 1 a251 1 1m--nopreserveHFSCompression0m d257 1 a257 1 1m--null 22m(use with 1m-I 22mor 1m-T22m) Filenames or patterns are separated by null d259 1 a259 1 names output by the 1m-print0 22moption to find(1). d261 1 a261 20 1m--no-acls0m (c, r, u, x modes only) Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--acls 22mand the default behav‐ ior if 1mtar 22mis run as non-root in x mode (on Mac OS X also in c, r and u modes). 1m--no-fflags0m (c, r, u, x modes only) Do not archive or extract file flags. This is the reverse of 1m--fflags 22mand the default behavior if 1mtar0m is run as non-root in x mode. 1m--no-mac-metadata0m (x mode only) Mac OS X specific. Do not archive or extract ACLs and extended attributes using copyfile(3) in AppleDouble format. This is the reverse of 1m--mac-metadata22m. and the default behavior if 1mtar 22mis run as non-root in x mode. 1m-n22m, 1m--norecurse22m, 1m--no-recursion0m 1m--no-same-owner0m d263 1 a263 1 reverse of 1m--same-owner 22mand the default behavior if 1mtar 22mis run as d266 1 a266 1 1m--no-same-permissions0m d269 2 a270 8 the reverse of 1m-p 22mand the default behavior if 1mtar 22mis run as non- root and can be overridden by also specifying 1m--acls22m, 1m--fflags22m, 1m--mac-metadata, --same-owner22m, 1m--same-permissions 22mand 1m--xattrs22m. 1m--no-xattrs0m (c, r, u, x modes only) Do not archive or extract extended attributes. This is the reverse of 1m--xattrs 22mand the default behavior if 1mtar 22mis run as non-root in x mode. d272 2 a273 2 1m--numeric-owner0m This is equivalent to 1m--uname 22m"" 1m--gname 22m"". On extract, it d278 1 a278 1 1m-O22m, 1m--to-stdout0m d284 1 a284 1 1m-o 22m(x mode) Use the user and group of the user running the program d286 1 a286 1 no significance unless 1m-p 22mis specified, and the program is being d291 1 a291 1 1m-o 22m(c, r, u mode) A synonym for 1m--format 4m22mustar0m d293 1 a293 1 1m--older 4m22mdate0m d297 2 a298 2 1m--older-mtime 4m22mdate0m (c, r, u modes only) Like 1m--older22m, except it compares mtime d301 1 a301 1 1m--older-than 4m22mfile0m d305 2 a306 2 1m--older-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--older-than22m, except it compares mtime d309 1 a309 1 1m--one-file-system0m d312 1 a312 1 1m--options 4m22moptions0m d318 1 a318 1 4mkey=value0m d322 3 a324 3 4mkey24m The key will be enabled in every module that supports it. This is equivalent to 4mkey24m1m=122m. 4m!key24m The key will be disabled in every module that supports d326 1 a326 1 4mmodule:key=value24m, 4mmodule:key24m, 4mmodule:!key0m d328 1 a328 1 provided only to modules whose name matches 4mmodule24m. d330 1 a330 1 1miso9660:joliet0m d332 2 a333 2 use 1m!joliet 22mor 1miso9660:!joliet 22mto disable. 1miso9660:rockridge0m d335 2 a336 2 default, use 1m!rockridge 22mor 1miso9660:!rockridge 22mto disable. 1mgzip:compression-level0m d339 1 a339 1 1mgzip:timestamp0m d341 3 a343 3 1m!timestamp 22mor 1mgzip:!timestamp 22mto disable. 1mlrzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are d346 1 a346 1 1mlrzip:compression-level0m d349 1 a349 1 1mlz4:compression-level0m d352 1 a352 1 1mlz4:stream-checksum0m d354 2 a355 2 1mlz4:!stream-checksum 22mto disable. 1mlz4:block-checksum0m d357 1 a357 1 1mlz4:block-size0m d360 1 a360 1 1mlz4:block-dependence0m d363 1 a363 1 1mlzop:compression-level0m d366 1 a366 1 1mxz:compression-level0m d369 1 a369 1 1mmtree:4m22mkeyword0m d372 3 a374 3 words include: 1mcksum22m, 1mdevice22m, 1mflags22m, 1mgid22m, 1mgname22m, 1mindent22m, 1mlink22m, 1mmd522m, 1mmode22m, 1mnlink22m, 1mrmd16022m, 1msha122m, 1msha25622m, 1msha38422m, 1msha51222m, 1msize22m, 1mtime22m, 1muid22m, 1muname22m. The default is equiva‐ d377 1 a377 1 1mmtree:all0m d379 4 a382 4 1mmtree:!all 22mto disable all keywords. 1mmtree:use-set0m Enable generation of 1m/set 22mlines in the output. 1mmtree:indent0m d385 2 a386 2 1mzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are d388 1 a388 1 1mzip:encryption0m d390 2 a391 2 1mzip:encryption22m=4mtype0m Use 4mtype24m as encryption type. Supported values are d395 1 a395 1 1mread_concatenated_archives0m d400 1 a400 1 ble to the 1m-i22m, 1m--ignore-zeros 22moption of GNU tar. d404 1 a404 1 1m-P22m, 1m--absolute-paths0m d407 2 a408 2 when creating archives and extracting from them. Also, 1mtar 22mwill refuse to extract archive entries whose pathnames contain 4m..24m or d412 1 a412 1 1m-p22m, 1m--insecure22m, 1m--preserve-permissions0m d414 5 a418 6 full permissions, including owner, file modes, ACLs, extended atributes and extended file flags, if available, for each item extracted from the archive. This is the default, if 1mtar 22mis being run by root and can be overridden by also specifying 1m--no-acls22m, 1m--no-fflags22m, 1m--no-mac-metadata, --no-same-owner22m, 1m--no-same-permissions 22mand 1m--no-xattrs22m. d420 2 a421 2 1m--passphrase 4m22mpassphrase0m The 4mpassphrase24m is used to extract or create an encrypted archive. d426 2 a427 2 1m--posix0m (c, r, u mode only) Synonym for 1m--format 4m22mpax0m d429 1 a429 1 1m-q22m, 1m--fast-read0m d438 1 a438 1 1m-S 22m(x mode only) Extract files as sparse files. For every block on d442 4 a445 4 1m-s 4m22mpattern0m Modify file or archive member names according to 4mpattern24m. The pattern has the format 4m/old/new/24m[ghHprRsS] where 4mold24m is a basic regular expression, 4mnew24m is the replacement string of the matched d447 2 a448 2 ment is handled. If 4mold24m is not matched, the pattern is skipped. Within 4mnew24m, ~ is substituted with the match, \1 to \9 with the d460 1 a460 1 The default is 4mhrs24m which applies substitutions to all names. In d463 1 a463 1 1m--same-owner0m d465 1 a465 1 of 1m--no-same-owner 22mand the default behavior if 1mtar 22mis run as d468 1 a468 1 1m--strip-components 4m22mcount0m d474 4 a477 4 1m-T 4m22mfilename24m, 1m--files-from 4m22mfilename0m In x or t mode, 1mtar 22mwill read the list of names to be extracted from 4mfilename24m. In c mode, 1mtar 22mwill read names to be archived from 4mfilename24m. The special name “-C” on a line by itself will d480 1 a480 1 unless 1m--null 22mis specified. Note that 1m--null 22malso disables the d483 1 a483 1 1m-n 22mas well. d485 3 a487 3 1m--totals0m (c, r, u modes only) After archiving all files, print a summary to stderr. d489 1 a489 1 1m-U22m, 1m--unlink22m, 1m--unlink-first0m d493 1 a493 1 flag also causes 1mtar 22mto remove intervening directory symlinks d497 1 a497 1 1m--uid 4m22mid0m d499 1 a499 1 archive. On create, if 1m--uname 22mis not also specified, the user d502 1 a502 1 1m--uname 4m22mname0m d506 1 a506 1 or from the 1m--uid 22moption) will be used instead. On create, this d510 1 a510 1 1m--use-compress-program 4m22mprogram0m d512 1 a512 1 4mprogram24m instead of using the builtin compression support. d514 2 a515 2 1m-v22m, 1m--verbose0m Produce verbose output. In create and extract modes, 1mtar 22mwill d517 2 a518 2 In list mode, 1mtar 22mwill produce output similar to that of ls(1). An additional 1m-v 22moption will also provide ls-like details in cre‐ d521 2 a522 2 1m--version0m Print version of 1mtar 22mand 1mlibarchive22m, and exit. d524 1 a524 1 1m-w22m, 1m--confirmation22m, 1m--interactive0m d527 1 a527 1 1m-X 4m22mfilename24m, 1m--exclude-from 4m22mfilename0m d529 1 a529 6 1m--exclude 22mfor more information about the handling of exclusions. 1m--xattrs0m (c, r, u, x modes only) Archive or extract extended attributes. This is the reverse of 1m--no-xattrs 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. d531 1 a531 1 1m-y 22m(c mode only) Compress the resulting archive with bzip2(1). In d533 1 a533 1 other 1mtar 22mimplementations, this implementation recognizes bzip2 d536 1 a536 1 1m-Z22m, 1m--compress22m, 1m--uncompress0m d539 1 a539 1 unlike other 1mtar 22mimplementations, this implementation recognizes d542 1 a542 1 1m-z22m, 1m--gunzip22m, 1m--gzip0m d545 1 a545 1 other 1mtar 22mimplementations, this implementation recognizes gzip d548 2 a549 2 1mENVIRONMENT0m The following environment variables affect the execution of 1mtar22m: d553 1 a553 1 ers. The 1m--options 22moption overrides this. d557 1 a557 1 ers. The 1m--options 22moption overrides this. d561 2 a562 2 TAPE The default device. The 1m-f 22moption overrides this. Please see the description of the 1m-f 22moption above for more details. d567 2 a568 2 1mEXIT STATUS0m The 1mtar 22mutility exits 0 on success, and >0 if an error occurs. d570 4 a573 4 1mEXAMPLES0m The following creates a new archive called 4mfile.tar.gz24m that contains two files 4msource.c24m and 4msource.h24m: 1mtar -czf 4m22mfile.tar.gz24m 4msource.c24m 4msource.h0m d576 1 a576 1 1mtar -tvf 4m22mfile.tar.gz0m d579 1 a579 1 1mtar -x0m d582 1 a582 1 1mtar -tf 4m22mimage.iso0m d584 2 a585 2 To move file hierarchies, invoke 1mtar 22mas 1mtar -cf 4m22m-24m 1m-C 4m22msrcdir24m 4m.24m | 1mtar -xpf 4m22m-24m 1m-C 4m22mdestdir0m d587 1 a587 1 cd srcdir ; 1mtar -cf 4m22m-24m 4m.24m | (4mcd24m 4mdestdir24m 4m;24m 1mtar -xpf 4m22m-24m) d590 4 a593 4 include directory change instructions of the form 1m-C4m22mfoo/baz24m and archive inclusions of the form 1m@@4m22marchive-file24m. For example, the command line 1mtar -c -f 4m22mnew.tar24m 4mfoo124m 1m@@4m22mold.tgz24m 1m-C4m22m/tmp24m 4mfoo20m will create a new archive 4mnew.tar24m. 1mtar 22mwill read the file 4mfoo124m from the d595 2 a596 2 each entry from 4mold.tgz24m and add those entries to the output archive. Finally, it will switch to the 4m/tmp24m directory and add 4mfoo224m to the output d609 1 a609 1 The 1m--newer 22mand 1m--newer-mtime 22mswitches accept a variety of common date d613 1 a613 1 The 1m--options 22margument can be used to control various details of archive d615 2 a616 2 only contains 1mtype22m, 1mtime22m, and 1muid 22mkeywords: 1mtar -cf 4m22mfile.tar24m 1m--format=mtree --options='!all,type,time,uid' 4m22mdir0m d618 3 a620 3 1mtar -czf 4m22mfile.tar24m 1m--options='compression-level=9'22m. For more details, see the explanation of the 1marchive_read_set_options22m() and 1marchive_write_set_options22m() API calls that are described in d623 1 a623 1 1mCOMPATIBILITY0m d629 4 a632 4 1mtar tbf 32 4m22mfile.tar0m specifies three flags 1mt22m, 1mb22m, and 1mf22m. The 1mb 22mand 1mf 22mflags both require argu‐ ments, so there must be two additional items on the command line. The 4m320m is the argument to the 1mb 22mflag, and 4mfile.tar24m is the argument to the 1mf0m d638 3 a640 3 For maximum portability, scripts that invoke 1mtar 22mshould use the bundled- argument format above, should limit themselves to the 1mc22m, 1mt22m, and 1mx 22mmodes, and the 1mb22m, 1mf22m, 1mm22m, 1mv22m, and 1mw 22moptions. d645 1 a645 1 1mSECURITY0m d647 1 a647 1 1mtar22m. In particular, carefully-crafted archives can request that 1mtar0m d652 1 a652 1 three ways this can happen. Although 1mtar 22mhas mechanisms to protect d655 2 a656 2 1m· 22mArchive entries can have absolute pathnames. By default, 1mtar0m removes the leading 4m/24m character from filenames before restoring d659 2 a660 2 1m· 22mArchive entries can have pathnames that include 4m..24m components. By default, 1mtar 22mwill not extract files containing 4m..24m components d663 1 a663 1 1m· 22mArchive entries can exploit symbolic links to restore files to d666 1 a666 1 directory. To guard against this, 1mtar 22mchecks each extracted path d668 1 a668 1 removed and replaced with the archive entry. If 1m-U 22mis specified, d670 1 a670 1 If neither 1m-U 22mnor 1m-P 22mis specified, 1mtar 22mwill refuse to extract the d674 3 a676 3 1mtar -tf 4m22mfilename0m before extraction. You should use the 1m-k 22moption to ensure that 1mtar 22mwill not overwrite any existing files or the 1m-U 22moption to remove any pre- d678 1 a678 1 with super-user privileges. Note that the 1m-P 22moption to 1mtar 22mdisables the d680 1 a680 1 ing any absolute pathnames, 4m..24m components, or symlinks to other directo‐ d683 1 a683 1 1mSEE ALSO0m d687 1 a687 1 1mSTANDARDS0m d697 2 a698 2 1mHISTORY0m A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in d700 1 a700 1 which extended the file format. John Gilmore's 1mpdtar 22mpublic-domain d708 1 a708 1 1mBUGS0m d710 2 a711 2 of the 1m-l 22moption. Note that GNU tar prior to version 1.15 treated 1m-l 22mas a synonym for the 1m--one-file-system 22moption. d713 1 a713 1 The 1m-C 4m22mdir24m option may differ from historic implementations. d723 1 a723 1 when decompressing an archive created by 1mtar22m, although they still extract d728 1 a728 1 1mtar -czf 4m22m-24m 4mfile0m d730 1 a730 1 1mtar -cf 4m22m-24m 4mfile24m | 1mgzip0m d735 3 a737 3 The 1mr 22mand 1mu 22mmodes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using 1mc 22mmode with the 4m@@archive-file24m extension. d739 2 a740 2 To archive a file called 4m@@foo24m or 4m-foo24m you must specify it as 4m./@@foo24m or 4m./-foo24m, respectively. d742 2 a743 2 In create mode, a leading 4m./24m is always removed. A leading 4m/24m is stripped unless the 1m-P 22moption is specified. d751 1 a751 1 using the 1m@@4m22m-24m convention can cause hard link information to be lost. d755 1 a755 1 BSD February 24, 2017 BSD @ 1.1.1.8 log @Import libarchive-3.3.2 + 9de5f3 + f9dacbf: - Support NFS4 ACLs on Linux - Bugfixes @ text @d3 2 a4 2 NAME tar — manipulate tape archives d6 5 a10 5 SYNOPSIS tar [bundled-flags ⟨args⟩] [⟨file⟩ | ⟨pattern⟩ ...] tar {-c} [options] [files | directories] tar {-r | -u} -f archive-file [options] [files | directories] tar {-t | -x} [options] [patterns] d12 2 a13 2 DESCRIPTION tar creates and manipulates streaming archive files. This implementation d23 4 a26 4 tar is a mode indicator from the following list: -c Create a new archive containing the specified items. The long option form is --create. -r Like -c, but new entries are appended to the archive. Note that d28 3 a30 3 The -f option is required. The long option form is --append. -t List archive contents to stdout. The long option form is --list. -u Like -r, but new entries are added only if they have a modifica‐ d33 3 a35 3 ular files. The -f option is required. The long form is --update. -x Extract to disk from the archive. If a file with the same name d38 1 a38 1 copies. The long option form is --extract. d40 1 a40 1 In -c, -r, or -u mode, each specified file or directory is added to the d49 1 a49 1 OPTIONS d53 1 a53 1 @@archive d57 4 a60 4 tar -c -f - newfile @@original.tar writes a new archive to standard output containing a file newfile and all of the entries from original.tar. In contrast, tar -c -f - newfile original.tar d62 1 a62 1 tar -czf - --format pax @@- d65 1 a65 1 format archive on stdout. In this way, tar can be used to con‐ d68 1 a68 1 -a, --auto-compress d71 1 a71 1 tar -a -cf archive.tgz source.c source.h d74 1 a74 1 tar -a -cf archive.tar.bz2.uu source.c source.h d77 1 a77 1 tar -a -cf archive.zip source.c source.h d79 1 a79 1 tar -a -jcf archive.tgz source.c source.h d82 1 a82 1 tar -a -jcf archive.xxx source.c source.h d86 5 a90 5 --acls (c, r, u, x modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of --no-acls and the default behavior in c, r, and u modes (except on Mac OS X) or if tar is run in x mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the --mac-metadata option is d93 1 a93 1 -B, --read-full-blocks d96 1 a96 1 -b blocksize, --block-size blocksize d102 1 a102 1 -C directory, --cd directory, --directory directory d107 3 a109 3 --chroot (x mode only) chroot() to the current directory after processing any -C options and before extracting any files. d111 1 a111 1 --clear-nochange-fflags d116 1 a116 1 --exclude pattern d121 1 a121 1 --fflags d123 2 a124 2 the reverse of --no-fflags and the default behavior in c, r, and u modes or if tar is run in x mode as root. d126 1 a126 1 --format format d135 1 a135 1 -f file, --file file d137 3 a139 3 The filename can be - for standard input or standard output. The default varies by system; on FreeBSD, the default is /dev/sa0; on Linux, the default is /dev/st0. d141 1 a141 1 --gid id d145 1 a145 1 if --gname is not also specified, the group name will be set to d148 1 a148 1 --gname name d152 1 a152 1 --gid option) will be used instead. On create, this sets the d156 1 a156 1 -H (c and r modes only) Symbolic links named on the command line d160 1 a160 1 -h (c and r modes only) Synonym for -L. d162 1 a162 1 -I Synonym for -T. d164 1 a164 1 --help Show usage. d166 1 a166 1 --hfsCompression d170 2 a171 2 --ignore-zeros An alias of --options read_concatenated_archives for compatibil‐ d174 1 a174 1 --include pattern d176 1 a176 1 tern. Note that exclusions specified with --exclude take prece‐ d178 1 a178 1 fied, all entries are processed by default. The --include option d181 3 a183 3 tar -c -f new.tar --include='*foo*' @@old.tgz creates a new archive new.tar containing only the entries from old.tgz containing the string ‘foo’. d185 1 a185 1 -J, --xz d188 1 a188 1 other tar implementations, this implementation recognizes XZ com‐ d191 1 a191 1 -j, --bzip, --bzip2, --bunzip2 d194 1 a194 1 other tar implementations, this implementation recognizes bzip2 d197 1 a197 1 -k, --keep-old-files d202 1 a202 1 --keep-newer-files d206 1 a206 1 -L, --dereference d211 1 a211 1 -l, --check-links d215 1 a215 1 --lrzip d219 1 a219 1 --lz4 (c mode only) Compress the archive with lz4-compatible compres‐ d223 1 a223 1 --lzma (c mode only) Compress the resulting archive with the original d225 2 a226 2 chives should be created with --xz instead. Note that, unlike other tar implementations, this implementation recognizes LZMA d229 1 a229 1 --lzop (c mode only) Compress the resulting archive with lzop(1). In d232 1 a232 1 -m, --modification-time d236 1 a236 1 --mac-metadata d239 2 a240 2 Double format. This is the reverse of --no-mac-metadata. and the default behavior in c, r, and u modes or if tar is run in x mode d243 1 a243 1 -n, --norecurse, --no-recursion d247 1 a247 1 --newer date d251 2 a252 2 --newer-mtime date (c, r, u modes only) Like --newer, except it compares mtime d255 1 a255 1 --newer-than file d259 2 a260 2 --newer-mtime-than file (c, r, u modes only) Like --newer-than, except it compares mtime d263 1 a263 1 --nodump d267 2 a268 2 --nopreserveHFSCompression (x mode only) Mac OS X specific (v10.6 or later). Do not compress d273 1 a273 1 --null (use with -I or -T) Filenames or patterns are separated by null d275 1 a275 1 names output by the -print0 option to find(1). d277 1 a277 1 --no-acls d279 3 a281 3 NFSv4 ACLs. This is the reverse of --acls and the default behav‐ ior if tar is run as non-root in x mode (on Mac OS X as any user in c, r, u and x modes). d283 1 a283 1 --no-fflags d285 1 a285 1 This is the reverse of --fflags and the default behavior if tar d288 1 a288 1 --no-mac-metadata d291 2 a292 2 This is the reverse of --mac-metadata. and the default behavior if tar is run as non-root in x mode. d294 1 a294 1 -n, --norecurse, --no-recursion d296 1 a296 1 --no-same-owner d298 1 a298 1 reverse of --same-owner and the default behavior if tar is run as d301 1 a301 1 --no-same-permissions d304 3 a306 2 the reverse of -p and the default behavior if tar is run as non- root. d308 1 a308 1 --no-xattrs d310 2 a311 2 attributes. This is the reverse of --xattrs and the default behavior if tar is run as non-root in x mode. d313 2 a314 2 --numeric-owner This is equivalent to --uname "" --gname "". On extract, it d319 1 a319 1 -O, --to-stdout d325 1 a325 1 -o (x mode) Use the user and group of the user running the program d327 1 a327 1 no significance unless -p is specified, and the program is being d332 1 a332 1 -o (c, r, u mode) A synonym for --format ustar d334 1 a334 1 --older date d338 2 a339 2 --older-mtime date (c, r, u modes only) Like --older, except it compares mtime d342 1 a342 1 --older-than file d346 2 a347 2 --older-mtime-than file (c, r, u modes only) Like --older-than, except it compares mtime d350 1 a350 1 --one-file-system d353 1 a353 1 --options options d359 1 a359 1 key=value d363 3 a365 3 key The key will be enabled in every module that supports it. This is equivalent to key=1. !key The key will be disabled in every module that supports d367 1 a367 1 module:key=value, module:key, module:!key d369 1 a369 1 provided only to modules whose name matches module. d371 1 a371 1 iso9660:joliet d373 2 a374 2 use !joliet or iso9660:!joliet to disable. iso9660:rockridge d376 2 a377 2 default, use !rockridge or iso9660:!rockridge to disable. gzip:compression-level d380 1 a380 1 gzip:timestamp d382 3 a384 3 !timestamp or gzip:!timestamp to disable. lrzip:compression=type Use type as compression method. Supported values are d387 1 a387 1 lrzip:compression-level d390 1 a390 1 lz4:compression-level d393 1 a393 1 lz4:stream-checksum d395 2 a396 2 lz4:!stream-checksum to disable. lz4:block-checksum d398 1 a398 1 lz4:block-size d401 1 a401 1 lz4:block-dependence d404 1 a404 1 lzop:compression-level d407 1 a407 1 xz:compression-level d410 1 a410 1 mtree:keyword d413 3 a415 3 words include: cksum, device, flags, gid, gname, indent, link, md5, mode, nlink, rmd160, sha1, sha256, sha384, sha512, size, time, uid, uname. The default is equiva‐ d418 1 a418 1 mtree:all d420 4 a423 4 mtree:!all to disable all keywords. mtree:use-set Enable generation of /set lines in the output. mtree:indent d426 2 a427 2 zip:compression=type Use type as compression method. Supported values are d429 1 a429 1 zip:encryption d431 2 a432 2 zip:encryption=type Use type as encryption type. Supported values are d436 1 a436 1 read_concatenated_archives d441 1 a441 1 ble to the -i, --ignore-zeros option of GNU tar. d445 1 a445 1 -P, --absolute-paths d448 2 a449 2 when creating archives and extracting from them. Also, tar will refuse to extract archive entries whose pathnames contain .. or d453 1 a453 1 -p, --insecure, --preserve-permissions d456 5 a460 5 attributes and extended file flags, if available, for each item extracted from the archive. This is te reverse of --no-same-permissions and the default if tar is being run by root and can be partially overridden by also specifying --no-acls, --no-fflags, --no-mac-metadata or --no-xattrs. d462 2 a463 2 --passphrase passphrase The passphrase is used to extract or create an encrypted archive. d468 2 a469 2 --posix (c, r, u mode only) Synonym for --format pax d471 1 a471 1 -q, --fast-read d480 1 a480 1 -S (x mode only) Extract files as sparse files. For every block on d484 4 a487 4 -s pattern Modify file or archive member names according to pattern. The pattern has the format /old/new/[ghHprRsS] where old is a basic regular expression, new is the replacement string of the matched d489 2 a490 2 ment is handled. If old is not matched, the pattern is skipped. Within new, ~ is substituted with the match, \1 to \9 with the d502 1 a502 1 The default is hrs which applies substitutions to all names. In d505 1 a505 1 --same-owner d507 1 a507 1 of --no-same-owner and the default behavior if tar is run as d510 1 a510 1 --strip-components count d516 4 a519 4 -T filename, --files-from filename In x or t mode, tar will read the list of names to be extracted from filename. In c mode, tar will read names to be archived from filename. The special name “-C” on a line by itself will d522 1 a522 1 unless --null is specified. Note that --null also disables the d525 1 a525 1 -n as well. d527 1 a527 1 --totals d531 1 a531 1 -U, --unlink, --unlink-first d535 1 a535 1 flag also causes tar to remove intervening directory symlinks d539 1 a539 1 --uid id d541 1 a541 1 archive. On create, if --uname is not also specified, the user d544 1 a544 1 --uname name d548 1 a548 1 or from the --uid option) will be used instead. On create, this d552 1 a552 1 --use-compress-program program d554 1 a554 1 program instead of using the builtin compression support. d556 2 a557 2 -v, --verbose Produce verbose output. In create and extract modes, tar will d559 2 a560 2 In list mode, tar will produce output similar to that of ls(1). An additional -v option will also provide ls-like details in cre‐ d563 2 a564 2 --version Print version of tar and libarchive, and exit. d566 1 a566 1 -w, --confirmation, --interactive d569 1 a569 1 -X filename, --exclude-from filename d571 1 a571 1 --exclude for more information about the handling of exclusions. d573 1 a573 1 --xattrs d575 2 a576 2 This is the reverse of --no-xattrs and the default behavior in c, r, and u modes or if tar is run in x mode as root. d578 1 a578 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d580 1 a580 1 other tar implementations, this implementation recognizes bzip2 d583 1 a583 1 -Z, --compress, --uncompress d586 1 a586 1 unlike other tar implementations, this implementation recognizes d589 1 a589 1 -z, --gunzip, --gzip d592 1 a592 1 other tar implementations, this implementation recognizes gzip d595 2 a596 2 ENVIRONMENT The following environment variables affect the execution of tar: d600 1 a600 1 ers. The --options option overrides this. d604 1 a604 1 ers. The --options option overrides this. d608 2 a609 2 TAPE The default device. The -f option overrides this. Please see the description of the -f option above for more details. d614 2 a615 2 EXIT STATUS The tar utility exits 0 on success, and >0 if an error occurs. d617 4 a620 4 EXAMPLES The following creates a new archive called file.tar.gz that contains two files source.c and source.h: tar -czf file.tar.gz source.c source.h d623 1 a623 1 tar -tvf file.tar.gz d626 1 a626 1 tar -x d629 1 a629 1 tar -tf image.iso d631 2 a632 2 To move file hierarchies, invoke tar as tar -cf - -C srcdir . | tar -xpf - -C destdir d634 1 a634 1 cd srcdir ; tar -cf - . | (cd destdir ; tar -xpf -) d637 4 a640 4 include directory change instructions of the form -Cfoo/baz and archive inclusions of the form @@archive-file. For example, the command line tar -c -f new.tar foo1 @@old.tgz -C/tmp foo2 will create a new archive new.tar. tar will read the file foo1 from the d642 2 a643 2 each entry from old.tgz and add those entries to the output archive. Finally, it will switch to the /tmp directory and add foo2 to the output d656 1 a656 1 The --newer and --newer-mtime switches accept a variety of common date d660 1 a660 1 The --options argument can be used to control various details of archive d662 2 a663 2 only contains type, time, and uid keywords: tar -cf file.tar --format=mtree --options='!all,type,time,uid' dir d665 3 a667 3 tar -czf file.tar --options='compression-level=9'. For more details, see the explanation of the archive_read_set_options() and archive_write_set_options() API calls that are described in d670 1 a670 1 COMPATIBILITY d676 4 a679 4 tar tbf 32 file.tar specifies three flags t, b, and f. The b and f flags both require argu‐ ments, so there must be two additional items on the command line. The 32 is the argument to the b flag, and file.tar is the argument to the f d685 3 a687 3 For maximum portability, scripts that invoke tar should use the bundled- argument format above, should limit themselves to the c, t, and x modes, and the b, f, m, v, and w options. d692 1 a692 1 SECURITY d694 1 a694 1 tar. In particular, carefully-crafted archives can request that tar d699 1 a699 1 three ways this can happen. Although tar has mechanisms to protect d702 2 a703 2 · Archive entries can have absolute pathnames. By default, tar removes the leading / character from filenames before restoring d706 2 a707 2 · Archive entries can have pathnames that include .. components. By default, tar will not extract files containing .. components d710 1 a710 1 · Archive entries can exploit symbolic links to restore files to d713 1 a713 1 directory. To guard against this, tar checks each extracted path d715 1 a715 1 removed and replaced with the archive entry. If -U is specified, d717 1 a717 1 If neither -U nor -P is specified, tar will refuse to extract the d721 3 a723 3 tar -tf filename before extraction. You should use the -k option to ensure that tar will not overwrite any existing files or the -U option to remove any pre- d725 1 a725 1 with super-user privileges. Note that the -P option to tar disables the d727 1 a727 1 ing any absolute pathnames, .. components, or symlinks to other directo‐ d730 1 a730 1 SEE ALSO d734 1 a734 1 STANDARDS d744 2 a745 2 HISTORY A tar command appeared in Seventh Edition Unix, which was released in d747 1 a747 1 which extended the file format. John Gilmore's pdtar public-domain d755 1 a755 1 BUGS d757 2 a758 2 of the -l option. Note that GNU tar prior to version 1.15 treated -l as a synonym for the --one-file-system option. d760 1 a760 1 The -C dir option may differ from historic implementations. d770 1 a770 1 when decompressing an archive created by tar, although they still extract d775 1 a775 1 tar -czf - file d777 1 a777 1 tar -cf - file | gzip d782 3 a784 3 The r and u modes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using c mode with the @@archive-file extension. d786 2 a787 2 To archive a file called @@foo or -foo you must specify it as ./@@foo or ./-foo, respectively. d789 2 a790 2 In create mode, a leading ./ is always removed. A leading / is stripped unless the -P option is specified. d798 1 a798 1 using the @@- convention can cause hard link information to be lost. d802 1 a802 1 BSD February 25, 2017 BSD @ 1.1.1.9 log @Import libarchive-3.3.3 as should have done originally. @ text @d187 3 a189 3 extract or list modes, this option is ignored. Note that this tar implementation recognizes XZ compression automatically when reading archives. d193 3 a195 3 extract or list modes, this option is ignored. Note that this tar implementation recognizes bzip2 compression automatically when reading archives. d217 1 a217 3 extract or list modes, this option is ignored. Note that this tar implementation recognizes lrzip compression automatically when reading archives. d220 2 a221 8 sion before writing it. In extract or list modes, this option is ignored. Note that this tar implementation recognizes lz4 com‐ pression automatically when reading archives. --zstd (c mode only) Compress the archive with zstd-compatible compres‐ sion before writing it. In extract or list modes, this option is ignored. Note that this tar implementation recognizes zstd com‐ pression automatically when reading archives. d224 4 a227 5 LZMA algorithm. In extract or list modes, this option is ignored. Use of this option is discouraged and new archives should be created with --xz instead. Note that this tar imple‐ mentation recognizes LZMA compression automatically when reading archives. d230 1 a230 3 extract or list modes, this option is ignored. Note that this tar implementation recognizes LZO compression automatically when reading archives. a402 3 zstd:compression-level A decimal integer from 1 to 22 specifying the zstd com‐ pression level. d578 3 a580 3 extract or list modes, this option is ignored. Note that this tar implementation recognizes bzip2 compression automatically when reading archives. d584 3 a586 3 In extract or list modes, this option is ignored. Note that this tar implementation recognizes compress compression automatically when reading archives. d590 3 a592 3 extract or list modes, this option is ignored. Note that this tar implementation recognizes gzip compression automatically when reading archives. d801 1 a801 1 BSD October 1, 2017 BSD @ 1.1.1.10 log @Import libarchive 3.4.0 @ text @d36 2 a37 2 appears more than once in the archive, each copy will be ex‐ tracted, with later copies overwriting (replacing) earlier d44 2 a45 2 In extract or list mode, the entire command line is read and parsed be‐ fore the archive is opened. The pathnames or patterns on the command d54 3 a56 3 (c and r modes only) The specified archive is opened and the en‐ tries in it will be appended to the current archive. As a simple example, d80 2 a81 2 ignores the “-j” option, and creates a new archive with re‐ stricted pax format and gzip compression, d113 2 a114 2 them, clear platform-specific file attributes or file flags that might prevent removal. a120 5 --exclude-vcs Do not process files or directories internally used by the ver‐ sion control systems ‘CVS’, ‘RCS’, ‘SCCS’, ‘SVN’, ‘Arch’, ‘Bazaar’, ‘Mercurial’ and ‘Darcs’. d122 3 a124 4 (c, r, u, x modes only) Archive or extract platform-specific file attributes or file flags. This is the reverse of --no-fflags and the default behavior in c, r, and u modes or if tar is run in x mode as root. d167 2 a168 2 (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ tracted regular files with HFS+ compression. d186 4 a189 4 (c mode only) Compress the resulting archive with xz(1). In ex‐ tract or list modes, this option is ignored. Note that this tar implementation recognizes XZ compression automatically when read‐ ing archives. d232 5 a236 4 LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives should be created with --xz instead. Note that this tar implementation recognizes LZMA compression automatically when reading archives. d249 4 a252 4 extended ACLs and extended file attributes using copyfile(3) in AppleDouble format. This is the reverse of --no-mac-metadata. and the default behavior in c, r, and u modes or if tar is run in x mode as root. d255 2 a256 1 Do not operate recursively on the content of directories. d263 2 a264 2 (c, r, u modes only) Like --newer, except it compares mtime en‐ tries instead of ctime entries. d295 3 a297 3 (c, r, u, x modes only) Do not archive or extract file attributes or file flags. This is the reverse of --fflags and the default behavior if tar is run as non-root in x mode. d301 5 a305 3 and extended file attributes using copyfile(3) in AppleDouble format. This is the reverse of --mac-metadata. and the default behavior if tar is run as non-root in x mode. d314 3 a316 3 bit, file attributes or file flags, extended file attributes and ACLs). This is the reverse of -p and the default behavior if tar is run as non-root. d319 3 a321 3 (c, r, u, x modes only) Do not archive or extract extended file attributes. This is the reverse of --xattrs and the default be‐ havior if tar is run as non-root in x mode. d349 2 a350 2 (c, r, u modes only) Like --older, except it compares mtime en‐ tries instead of ctime entries. d385 2 a386 2 Support Rock Ridge extensions. This is enabled by de‐ fault, use !rockridge or iso9660:!rockridge to disable. d463 2 a464 2 whose target directory would be altered by a symlink. This op‐ tion suppresses these behaviors. d468 6 a473 6 full permissions, including file modes, file attributes or file flags, extended file attributes and ACLs, if available, for each item extracted from the archive. This is the reverse of --no-same-permissions and the default if tar is being run as root. It can be partially overridden by also specifying --no-acls, --no-fflags, --no-mac-metadata or --no-xattrs. d489 2 a490 2 multiple entries with the same name and, by convention, later en‐ tries overwrite earlier entries. This option is provided as a d534 2 a535 2 fied on the following line. Names are terminated by newlines un‐ less --null is specified. Note that --null also disables the d548 3 a550 3 flag also causes tar to remove intervening directory symlinks in‐ stead of reporting an error. See the SECURITY section below for more details. d587 3 a589 3 (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of --no-xattrs and the default be‐ havior in c, r, and u modes or if tar is run in x mode as root. d655 2 a656 2 each entry from old.tgz and add those entries to the output archive. Fi‐ nally, it will switch to the /tmp directory and add foo2 to the output d707 3 a709 3 tar. In particular, carefully-crafted archives can request that tar ex‐ tract files to locations outside of the target directory. This can po‐ tentially be used to cause unwitting users to overwrite files they did d715 2 a716 2 • Archive entries can have absolute pathnames. By default, tar re‐ moves the leading / character from filenames before restoring d719 1 a719 1 • Archive entries can have pathnames that include .. components. d723 3 a725 3 • Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to an‐ other directory, then use that link to restore a file into that d736 2 a737 2 not overwrite any existing files or the -U option to remove any pre-ex‐ isting files. You should generally not extract archives while running d760 3 a762 3 which extended the file format. John Gilmore's pdtar public-domain im‐ plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in d777 4 a780 4 to a full block size varies depending on the format and the output de‐ vice. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being d810 4 a813 4 Converting between dissimilar archive formats (such as tar and cpio) us‐ ing the @@- convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) d815 1 a815 1 BSD June 3, 2019 BSD @ 1.1.1.11 log @Import libarchive 3.7.2 @ text @d22 1 a22 1 The other synopsis forms show the preferred usage. The first option to d24 1 a24 1 -c Create a new archive containing the specified items. The long d26 1 a26 1 -r Like -c, but new entries are appended to the archive. Note that d28 3 a30 3 The -f option is required. The long option form is --append. -t List archive contents to stdout. The long option form is --list. -u Like -r, but new entries are added only if they have a modifica‐ d35 1 a35 1 -x Extract to disk from the archive. If a file with the same name d87 1 a87 1 ACLs. This is the reverse of --no-acls and the default behavior d89 3 a91 3 mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the --mac-metadata option is preferred. d123 2 a124 2 sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’, ‘Mercurial’, ‘RCS’, ‘SCCS’, ‘SVN’ and ‘git’. d162 1 a162 1 -H (c and r modes only) Symbolic links named on the command line d166 1 a166 1 -h (c and r modes only) Synonym for -L. d168 1 a168 1 -I Synonym for -T. d243 1 a243 1 --lzop (c mode only) Compress the resulting archive with lzop(1). In d253 1 a253 1 (c, r, u and x mode only) Mac OS X specific. Archive or extract d255 1 a255 1 AppleDouble format. This is the reverse of --no-mac-metadata. d294 1 a294 1 NFSv4 ACLs. This is the reverse of --acls and the default behav‐ d300 1 a300 1 or file flags. This is the reverse of --fflags and the default d304 1 a304 1 (x mode only) Mac OS X specific. Do not archive or extract ACLs d306 1 a306 1 format. This is the reverse of --mac-metadata. and the default a308 8 --no-read-sparse (c, r, u modes only) Do not read sparse file information from disk. This is the reverse of --read-sparse. --no-safe-writes (x mode only) Do not create temporary files and use rename(2) to replace the original ones. This is the reverse of --safe-writes. d322 1 a322 1 attributes. This is the reverse of --xattrs and the default be‐ d328 1 a328 1 of the numeric user and group ids. On create, it causes user and d337 1 a337 1 -o (x mode) Use the user and group of the user running the program d344 1 a344 1 -o (c, r, u mode) A synonym for --format ustar d382 1 a382 6 The complete list of supported modules and keys for create and append modes is in archive_write_set_options(3) and for extract and list modes in archive_read_set_options(3). Examples of supported options: d384 1 a384 1 Support Joliet extensions. This is enabled by default, d393 1 a393 1 Store timestamp. This is enabled by default, use d406 1 a406 1 Enable stream checksum. This is by default, use d417 2 a418 17 A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. zstd:threads Specify the number of worker threads to use. Setting threads to a special value 0 makes zstd(1) use as many threads as there are CPU cores on the system. zstd:frame-per-file Start a new compression frame at the beginning of each file in the archive. zstd:min-frame-size=N In combination with zstd:frame-per-file, do not start a new compression frame unless the current frame is at least N bytes. zstd:max-frame-size=N Start a new compression frame as soon as the current frame exceeds N bytes. a424 4 xz:threads Specify the number of worker threads to use. Setting threads to a special value 0 makes xz(1) use as many threads as there are CPU cores on the system. d434 1 a434 1 Enables all of the above keywords. You can also use d472 1 a472 1 item extracted from the archive. This is the reverse of d474 1 a474 1 root. It can be partially overridden by also specifying d495 1 a495 5 --read-sparse (c, r, u modes only) Read sparse file information from disk. This is the reverse of --no-read-sparse and the default behavior. -S (x mode only) Extract files as sparse files. For every block on d497 1 a497 1 otherwise. This works similar to the conv=sparse option of dd. a519 13 --safe-writes (x mode only) Extract files atomically. By default tar unlinks the original file with the same name as the extracted file (if it exists), and then creates it immediately under the same name and writes to it. For a short period of time, applications trying to access the file might not find it, or see incomplete results. If --safe-writes is enabled, tar first creates a unique temporary file, then writes the new contents to the temporary file, and fi‐ nally renames the temporary file to its final name atomically us‐ ing rename(2). This guarantees that an application accessing the file, will either see the old contents or the new contents at all times. d521 1 a521 1 (x mode only) Extract owner and group IDs. This is the reverse d538 1 a538 1 special handling of lines containing “-C”. Note: If you are d549 1 a549 1 can make things slower if most files do not already exist. This d585 1 a585 1 Read a list of exclusion patterns from the specified file. See d590 1 a590 1 tributes. This is the reverse of --no-xattrs and the default be‐ d593 1 a593 1 -y (c mode only) Compress the resulting archive with bzip2(1). In d605 1 a605 1 (c mode only) Compress the resulting archive with gzip(1). In d614 2 a615 2 The default options for format readers and compression readers. The --options option overrides this. d618 2 a619 2 The default options for format writers and compression writers. The --options option overrides this. d621 1 a621 1 LANG The locale to use. See environ(7) for more information. d623 2 a624 2 TAPE The default device. The -f option overrides this. Please see the description of the -f option above for more details. d626 2 a627 2 TZ The timezone to use when displaying dates. See environ(7) for more information. d655 1 a655 1 will create a new archive new.tar. tar will read the file foo1 from the d692 1 a692 1 specifies three flags t, b, and f. The b and f flags both require argu‐ d726 1 a726 1 other directories. An archive can restore a symbolic link to an‐ d728 1 a728 1 directory. To guard against this, tar checks each extracted path d735 1 a735 1 untrusted sources. You should examine the contents of an archive with d737 1 a737 1 before extraction. You should use the -k option to ensure that tar will d817 1 a817 1 BSD December 1, 2022 BSD @ 1.1.1.12 log @libarchive: import version 3.7.3 @ text @a161 5 --group name[:gid] Use the provided group, if gid is not provided, name can be ei‐ ther a group name or numeric id. See the --gname option for de‐ tails. d257 1 a257 2 x mode as root. Currently supported only for pax formats (in‐ cluding "pax restricted", the default tar format for bsdtar.) d440 1 a440 7 zstd:min-frame-in=N In combination with zstd:frame-per-file, do not start a new compression frame unless the uncompressed size of the current frame is at least N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilo‐ bytes, megabytes or gigabytes respectively. zstd:min-frame-out=N, zstd:min-frame-size=N d442 5 a446 16 new compression frame unless the compressed size of the current frame is at least N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilo‐ bytes, megabytes or gigabytes respectively. zstd:max-frame-in=N, zstd:max-frame-size=N Start a new compression frame as soon as possible after the uncompressed size of the current frame exceeds N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilobytes, megabytes or gigabytes re‐ spectively. Values less than 1,024 will be rejected. zstd:max-frame-out=N Start a new compression frame as soon as possible after the compressed size of the current frame exceeds N bytes. The number may be followed by k / kB, M / MB, or G / GB to indicate kilobytes, megabytes or gigabytes respec‐ tively. Values less than 1,024 will be rejected. d537 1 a537 1 pattern has the format /old/new/[bghHprRsS] where old is a basic d548 7 a554 11 name should be printed to standard error. The optional trailing b specifies that the substitution should be matched from the be‐ ginning of the string rather than from right after the position at which the previous matching substitution ended. Optional trailing H, R, or S characters suppress substitutions for hardlink targets, regular filenames, or symlink targets, respec‐ tively. Optional trailing h, r, or s characters enable substitu‐ tions for hardlink targets, regular filenames, or symlink tar‐ gets, respectively. The default is hrs which applies substitu‐ tions to all names. In particular, it is never necessary to specify h, r, or s. a619 4 --owner name[:uid] Use the provided user, if uid is not provided, name can be either an username or numeric id. See the --uname option for details. d866 1 a866 1 BSD March 1, 2024 BSD @ 1.1.1.13 log @Libarchive 3.7.4 is a bugfix and security release Security fixes: rar: Fix OOB in rar e8 filter (CVE-2024-26256) zip: Fix out of boundary access Important bugfixes: 7zip: Limit amount of properties bsdtar: Fix error handling around strtol() usages passphrase: Improve newline handling on Windows passphrase: Never allow empty passwords rar: Fix "File CRC Error" when extracting specific rar4 archives xar: Avoid infinite link loop zip: Update AppleDouble support for directories zstd: Implement core detection @ text @d435 1 a435 1 zstd:compression-level=N d439 4 a442 3 zstd:threads=N Specify the number of worker threads to use, or 0 to use as many threads as there are CPU cores in the system. d897 1 a897 1 BSD April 23, 2024 BSD @ 1.1.1.14 log @libarchove: import version 3.7.7 @ text @d1 1 a1 1 4mTAR24m(1) General Commands Manual 4mTAR24m(1) d3 2 a4 2 1mNAME0m tar — manipulate tape archives d6 889 a894 909 1mSYNOPSIS0m 1mtar 22m[4mbundled-flags24m ⟨args⟩] [⟨4mfile24m⟩ | ⟨4mpattern24m⟩ ...] 1mtar 22m{1m-c22m} [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-r 22m| 1m-u22m} 1m-f 4m22marchive-file24m [4moptions24m] [4mfiles24m | 4mdirectories24m] 1mtar 22m{1m-t 22m| 1m-x22m} [4moptions24m] [4mpatterns24m] 1mDESCRIPTION0m 1mtar 22mcreates and manipulates streaming archive files. This implementa‐ tion can extract from tar, pax, cpio, zip, jar, ar, xar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives. The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See COM‐ PATIBILITY below for details. The other synopsis forms show the preferred usage. The first option to 1mtar 22mis a mode indicator from the following list: 1m-c 22mCreate a new archive containing the specified items. The long option form is 1m--create22m. 1m-r 22mLike 1m-c22m, but new entries are appended to the archive. Note that this only works on uncompressed archives stored in regular files. The 1m-f 22moption is required. The long option form is 1m--append22m. 1m-t 22mList archive contents to stdout. The long option form is 1m--list22m. 1m-u 22mLike 1m-r22m, but new entries are added only if they have a modifi‐ cation date newer than the corresponding entry in the archive. Note that this only works on uncompressed archives stored in regular files. The 1m-f 22moption is required. The long form is 1m--update22m. 1m-x 22mExtract to disk from the archive. If a file with the same name appears more than once in the archive, each copy will be ex‐ tracted, with later copies overwriting (replacing) earlier copies. The long option form is 1m--extract22m. In 1m-c22m, 1m-r22m, or 1m-u 22mmode, each specified file or directory is added to the archive in the order specified on the command line. By default, the contents of each directory are also archived. In extract or list mode, the entire command line is read and parsed be‐ fore the archive is opened. The pathnames or patterns on the command line indicate which items in the archive should be processed. Patterns are shell-style globbing patterns as documented in 4mtcsh24m(1). 1mOPTIONS0m Unless specifically stated otherwise, options are applicable in all op‐ erating modes. 1m@@4m22marchive0m (c and r modes only) The specified archive is opened and the entries in it will be appended to the current archive. As a simple example, 1mtar -c -f 4m22m-24m 4mnewfile24m 1m@@4m22moriginal.tar0m writes a new archive to standard output containing a file 4mnewfile24m and all of the entries from 4moriginal.tar24m. In contrast, 1mtar -c -f 4m22m-24m 4mnewfile24m 4moriginal.tar0m creates a new archive with only two entries. Similarly, 1mtar -czf 4m22m-24m 1m--format pax @@4m22m-0m reads an archive from standard input (whose format will be de‐ termined automatically) and converts it into a gzip-compressed pax-format archive on stdout. In this way, 1mtar 22mcan be used to convert archives from one format to another. 1m-a22m, 1m--auto-compress0m (c mode only) Use the archive suffix to decide a set of the format and the compressions. As a simple example, 1mtar -a -cf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m creates a new archive with restricted pax format and gzip com‐ pression, 1mtar -a -cf 4m22marchive.tar.bz2.uu24m 4msource.c24m 4msource.h0m creates a new archive with restricted pax format and bzip2 com‐ pression and uuencode compression, 1mtar -a -cf 4m22marchive.zip24m 4msource.c24m 4msource.h0m creates a new archive with zip format, 1mtar -a -jcf 4m22marchive.tgz24m 4msource.c24m 4msource.h0m ignores the “-j” option, and creates a new archive with re‐ stricted pax format and gzip compression, 1mtar -a -jcf 4m22marchive.xxx24m 4msource.c24m 4msource.h0m if it is unknown suffix or no suffix, creates a new archive with restricted pax format and bzip2 compression. 1m--acls 22m(c, r, u, x modes only) Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--no-acls 22mand the default behav‐ ior in c, r, and u modes (except on Mac OS X) or if 1mtar 22mis run in x mode as root. On Mac OS X this option translates extended ACLs to NFSv4 ACLs. To store extended ACLs the 1m--mac-metadata0m option is preferred. 1m-B22m, 1m--read-full-blocks0m Ignored for compatibility with other 4mtar24m(1) implementations. 1m-b 4m22mblocksize24m, 1m--block-size 4m22mblocksize0m Specify the block size, in 512-byte records, for tape drive I/O. As a rule, this argument is only needed when reading from or writing to tape drives, and usually not even then as the de‐ fault block size of 20 records (10240 bytes) is very common. 1m-C 4m22mdirectory24m, 1m--cd 4m22mdirectory24m, 1m--directory 4m22mdirectory0m In c and r mode, this changes the directory before adding the following files. In x mode, change directories after opening the archive but before extracting entries from the archive. 1m--chroot0m (x mode only) 1mchroot22m() to the current directory after process‐ ing any 1m-C 22moptions and before extracting any files. 1m--clear-nochange-fflags0m (x mode only) Before removing file system objects to replace them, clear platform-specific file attributes or file flags that might prevent removal. 1m--exclude 4m22mpattern0m Do not process files or directories that match the specified pattern. Note that exclusions take precedence over patterns or filenames specified on the command line. 1m--exclude-vcs0m Do not process files or directories internally used by the ver‐ sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’, ‘Mercurial’, ‘RCS’, ‘SCCS’, ‘SVN’ and ‘git’. 1m--fflags0m (c, r, u, x modes only) Archive or extract platform-specific file attributes or file flags. This is the reverse of 1m--no-fflags 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. 1m--format 4m22mformat0m (c, r, u mode only) Use the specified format for the created archive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see 4mlibarchive-formats24m(5) for more information about currently-sup‐ ported formats. In r and u modes, when extending an existing archive, the format specified here must be compatible with the format of the existing archive on disk. 1m-f 4m22mfile24m, 1m--file 4m22mfile0m Read the archive from or write the archive to the specified file. The filename can be 4m-24m for standard input or standard output. The default varies by system; on FreeBSD, the default is 4m/dev/sa024m; on Linux, the default is 4m/dev/st024m. 1m--gid 4m22mid0m Use the provided group id number. On extract, this overrides the group id in the archive; the group name in the archive will be ignored. On create, this overrides the group id read from disk; if 1m--gname 22mis not also specified, the group name will be set to match the group id. 1m--gname 4m22mname0m Use the provided group name. On extract, this overrides the group name in the archive; if the provided group name does not exist on the system, the group id (from the archive or from the 1m--gid 22moption) will be used instead. On create, this sets the group name that will be stored in the archive; the name will not be verified against the system group database. 1m--group 4m22mname24m[:4mgid24m] Use the provided group, if 4mgid24m is not provided, 4mname24m can be ei‐ ther a group name or numeric id. See the 1m--gname 22moption for details. 1m-H 22m(c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not the link itself. 1m-h 22m(c and r modes only) Synonym for 1m-L22m. 1m-I 22mSynonym for 1m-T22m. 1m--help 22mShow usage. 1m--hfsCompression0m (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ tracted regular files with HFS+ compression. 1m--ignore-zeros0m An alias of 1m--options read_concatenated_archives 22mfor compati‐ bility with GNU tar. 1m--include 4m22mpattern0m Process only files or directories that match the specified pat‐ tern. Note that exclusions specified with 1m--exclude 22mtake precedence over inclusions. If no inclusions are explicitly specified, all entries are processed by default. The 1m--include0m option is especially useful when filtering archives. For exam‐ ple, the command 1mtar -c -f 4m22mnew.tar24m 1m--include='*foo*' @@4m22mold.tgz0m creates a new archive 4mnew.tar24m containing only the entries from 4mold.tgz24m containing the string ‘foo’. 1m-J22m, 1m--xz0m (c mode only) Compress the resulting archive with 4mxz24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes XZ compression automatically when reading archives. 1m-j22m, 1m--bzip22m, 1m--bzip222m, 1m--bunzip20m (c mode only) Compress the resulting archive with 4mbzip224m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically when reading archives. 1m-k22m, 1m--keep-old-files0m (x mode only) Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies will not overwrite earlier copies. 1m--keep-newer-files0m (x mode only) Do not overwrite existing files that are newer than the versions appearing in the archive being extracted. 1m-L22m, 1m--dereference0m (c and r modes only) All symbolic links will be followed. Nor‐ mally, symbolic links are archived as such. With this option, the target of the link will be archived instead. 1m-l22m, 1m--check-links0m (c and r modes only) Issue a warning message unless all links to each file are archived. 1m--lrzip0m (c mode only) Compress the resulting archive with 4mlrzip24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lrzip compression automatically when reading archives. 1m--lz4 22m(c mode only) Compress the archive with lz4-compatible compres‐ sion before writing it. In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lz4 compression automatically when reading archives. 1m--zstd 22m(c mode only) Compress the archive with zstd-compatible com‐ pression before writing it. In extract or list modes, this op‐ tion is ignored. Note that this 1mtar 22mimplementation recognizes zstd compression automatically when reading archives. 1m--lzma 22m(c mode only) Compress the resulting archive with the original LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives should be created with 1m--xz 22minstead. Note that this 1mtar 22mimple‐ mentation recognizes LZMA compression automatically when read‐ ing archives. 1m--lzop 22m(c mode only) Compress the resulting archive with 4mlzop24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes LZO compression automatically when reading archives. 1m-m22m, 1m--modification-time0m (x mode only) Do not extract modification time. By default, the modification time is set to the time stored in the archive. 1m--mac-metadata0m (c, r, u and x mode only) Mac OS X specific. Archive or ex‐ tract extended ACLs and extended file attributes using 4mcopyfile24m(3) in AppleDouble format. This is the reverse of 1m--no-mac-metadata22m. and the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. Currently supported only for pax formats (including "pax restricted", the default tar format for bsdtar.) 1m-n22m, 1m--norecurse22m, 1m--no-recursion0m Do not operate recursively on the content of directories. 1m--newer 4m22mdate0m (c, r, u modes only) Only include files and directories newer than the specified date. This compares ctime entries. 1m--newer-mtime 4m22mdate0m (c, r, u modes only) Like 1m--newer22m, except it compares mtime en‐ tries instead of ctime entries. 1m--newer-than 4m22mfile0m (c, r, u modes only) Only include files and directories newer than the specified file. This compares ctime entries. 1m--newer-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--newer-than22m, except it compares mtime entries instead of ctime entries. 1m--nodump0m (c and r modes only) Honor the nodump file flag by skipping this file. 1m--nopreserveHFSCompression0m (x mode only) Mac OS X specific (v10.6 or later). Do not com‐ press extracted regular files which were compressed with HFS+ compression before archived. By default, compress the regular files again with HFS+ compression. 1m--null 22m(use with 1m-I 22mor 1m-T22m) Filenames or patterns are separated by null characters, not by newlines. This is often used to read file‐ names output by the 1m-print0 22moption to 4mfind24m(1). 1m--no-acls0m (c, r, u, x modes only) Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--acls 22mand the default be‐ havior if 1mtar 22mis run as non-root in x mode (on Mac OS X as any user in c, r, u and x modes). 1m--no-fflags0m (c, r, u, x modes only) Do not archive or extract file attrib‐ utes or file flags. This is the reverse of 1m--fflags 22mand the default behavior if 1mtar 22mis run as non-root in x mode. 1m--no-mac-metadata0m (x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using 4mcopyfile24m(3) in Apple‐ Double format. This is the reverse of 1m--mac-metadata22m. and the default behavior if 1mtar 22mis run as non-root in x mode. 1m--no-read-sparse0m (c, r, u modes only) Do not read sparse file information from disk. This is the reverse of 1m--read-sparse22m. 1m--no-safe-writes0m (x mode only) Do not create temporary files and use 4mrename24m(2) to replace the original ones. This is the reverse of 1m--safe-writes22m. 1m--no-same-owner0m (x mode only) Do not extract owner and group IDs. This is the reverse of 1m--same-owner 22mand the default behavior if 1mtar 22mis run as non-root. 1m--no-same-permissions0m (x mode only) Do not extract full permissions (SGID, SUID, sticky bit, file attributes or file flags, extended file at‐ tributes and ACLs). This is the reverse of 1m-p 22mand the default behavior if 1mtar 22mis run as non-root. 1m--no-xattrs0m (c, r, u, x modes only) Do not archive or extract extended file attributes. This is the reverse of 1m--xattrs 22mand the default behavior if 1mtar 22mis run as non-root in x mode. 1m--numeric-owner0m This is equivalent to 1m--uname 22m"" 1m--gname 22m"". On extract, it causes user and group names in the archive to be ignored in fa‐ vor of the numeric user and group ids. On create, it causes user and group names to not be stored in the archive. 1m-O22m, 1m--to-stdout0m (x, t modes only) In extract (-x) mode, files will be written to standard out rather than being extracted to disk. In list (-t) mode, the file listing will be written to stderr rather than the usual stdout. 1m-o 22m(x mode) Use the user and group of the user running the program rather than those specified in the archive. Note that this has no significance unless 1m-p 22mis specified, and the program is be‐ ing run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner in‐ formation in the archive will be discarded. 1m-o 22m(c, r, u mode) A synonym for 1m--format 4m22mustar0m 1m--older 4m22mdate0m (c, r, u modes only) Only include files and directories older than the specified date. This compares ctime entries. 1m--older-mtime 4m22mdate0m (c, r, u modes only) Like 1m--older22m, except it compares mtime en‐ tries instead of ctime entries. 1m--older-than 4m22mfile0m (c, r, u modes only) Only include files and directories older than the specified file. This compares ctime entries. 1m--older-mtime-than 4m22mfile0m (c, r, u modes only) Like 1m--older-than22m, except it compares mtime entries instead of ctime entries. 1m--one-file-system0m (c, r, and u modes) Do not cross mount points. 1m--options 4m22moptions0m Select optional behaviors for particular modules. The argument is a text string containing comma-separated keywords and val‐ ues. These are passed to the modules that handle particular formats to control how those formats will behave. Each option has one of the following forms: 4mkey=value0m The key will be set to the specified value in every module that supports it. Modules that do not support this key will ignore it. 4mkey24m The key will be enabled in every module that supports it. This is equivalent to 4mkey24m1m=122m. 4m!key24m The key will be disabled in every module that supports it. 4mmodule:key=value24m, 4mmodule:key24m, 4mmodule:!key0m As above, but the corresponding key and value will be provided only to modules whose name matches 4mmodule24m. The complete list of supported modules and keys for create and append modes is in 4marchive_write_set_options24m(3) and for extract and list modes in 4marchive_read_set_options24m(3). Examples of supported options: 1miso9660:joliet0m Support Joliet extensions. This is enabled by default, use 1m!joliet 22mor 1miso9660:!joliet 22mto disable. 1miso9660:rockridge0m Support Rock Ridge extensions. This is enabled by de‐ fault, use 1m!rockridge 22mor 1miso9660:!rockridge 22mto disable. 1mgzip:compression-level0m A decimal integer from 1 to 9 specifying the gzip com‐ pression level. 1mgzip:timestamp0m Store timestamp. This is enabled by default, use 1m!timestamp 22mor 1mgzip:!timestamp 22mto disable. 1mlrzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, ex‐ tremely slow). 1mlrzip:compression-level0m A decimal integer from 1 to 9 specifying the lrzip com‐ pression level. 1mlz4:compression-level0m A decimal integer from 1 to 9 specifying the lzop com‐ pression level. 1mlz4:stream-checksum0m Enable stream checksum. This is by default, use 1mlz4:!stream-checksum 22mto disable. 1mlz4:block-checksum0m Enable block checksum (Disabled by default). 1mlz4:block-size0m A decimal integer from 4 to 7 specifying the lz4 com‐ pression block size (7 is set by default). 1mlz4:block-dependence0m Use the previous block of the block being compressed for a compression dictionary to improve compression ra‐ tio. 1mzstd:compression-level22m=4mN0m A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. 1mzstd:threads22m=4mN0m Specify the number of worker threads to use, or 0 to use as many threads as there are CPU cores in the sys‐ tem. 1mzstd:frame-per-file0m Start a new compression frame at the beginning of each file in the archive. 1mzstd:min-frame-in22m=4mN0m In combination with 1mzstd:frame-per-file22m, do not start a new compression frame unless the uncompressed size of the current frame is at least 4mN24m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilobytes, megabytes or gigabytes respectively. 1mzstd:min-frame-out22m=4mN24m, 1mzstd:min-frame-size22m=4mN0m In combination with 1mzstd:frame-per-file22m, do not start a new compression frame unless the compressed size of the current frame is at least 4mN24m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilo‐ bytes, megabytes or gigabytes respectively. 1mzstd:max-frame-in22m=4mN24m, 1mzstd:max-frame-size22m=4mN0m Start a new compression frame as soon as possible after the uncompressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilobytes, megabytes or gigabytes respectively. Values less than 1,024 will be rejected. 1mzstd:max-frame-out22m=4mN0m Start a new compression frame as soon as possible after the compressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate kilobytes, megabytes or gigabytes respectively. Values less than 1,024 will be rejected. 1mlzop:compression-level0m A decimal integer from 1 to 9 specifying the lzop com‐ pression level. 1mxz:compression-level0m A decimal integer from 0 to 9 specifying the xz com‐ pression level. 1mxz:threads0m Specify the number of worker threads to use. Setting threads to a special value 0 makes 4mxz24m(1) use as many threads as there are CPU cores on the system. 1mmtree:4m22mkeyword0m The mtree writer module allows you to specify which mtree keywords will be included in the output. Sup‐ ported keywords include: 1mcksum22m, 1mdevice22m, 1mflags22m, 1mgid22m, 1mgname22m, 1mindent22m, 1mlink22m, 1mmd522m, 1mmode22m, 1mnlink22m, 1mrmd16022m, 1msha122m, 1msha25622m, 1msha38422m, 1msha51222m, 1msize22m, 1mtime22m, 1muid22m, 1muname22m. The default is equivalent to: “device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname”. 1mmtree:all0m Enables all of the above keywords. You can also use 1mmtree:!all 22mto disable all keywords. 1mmtree:use-set0m Enable generation of 1m/set 22mlines in the output. 1mmtree:indent0m Produce human-readable output by indenting options and splitting lines to fit into 80 columns. 1mzip:compression22m=4mtype0m Use 4mtype24m as compression method. Supported values are store (uncompressed) and deflate (gzip algorithm). 1mzip:encryption0m Enable encryption using traditional zip encryption. 1mzip:encryption22m=4mtype0m Use 4mtype24m as encryption type. Supported values are zipcrypt (traditional zip encryption), aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ tion). 1mread_concatenated_archives0m Ignore zeroed blocks in the archive, which occurs when multiple tar archives have been concatenated together. Without this option, only the contents of the first concatenated archive would be read. This option is comparable to the 1m-i22m, 1m--ignore-zeros 22moption of GNU tar. If a provided option is not supported by any module, that is a fatal error. 1m-P22m, 1m--absolute-paths0m Preserve pathnames. By default, absolute pathnames (those that begin with a / character) have the leading slash removed both when creating archives and extracting from them. Also, 1mtar0m will refuse to extract archive entries whose pathnames contain 4m..24m or whose target directory would be altered by a symlink. This option suppresses these behaviors. 1m-p22m, 1m--insecure22m, 1m--preserve-permissions0m (x mode only) Preserve file permissions. Attempt to restore the full permissions, including file modes, file attributes or file flags, extended file attributes and ACLs, if available, for each item extracted from the archive. This is the reverse of 1m--no-same-permissions 22mand the default if 1mtar 22mis being run as root. It can be partially overridden by also specifying 1m--no-acls22m, 1m--no-fflags22m, 1m--no-mac-metadata 22mor 1m--no-xattrs22m. 1m--passphrase 4m22mpassphrase0m The 4mpassphrase24m is used to extract or create an encrypted archive. Currently, zip is the only supported format that sup‐ ports encryption. You shouldn't use this option unless you re‐ alize how insecure use of this option is. 1m--posix0m (c, r, u mode only) Synonym for 1m--format 4m22mpax0m 1m-q22m, 1m--fast-read0m (x and t mode only) Extract or list only the first archive en‐ try that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by con‐ vention, later entries overwrite earlier entries. This option is provided as a performance optimization. 1m--read-sparse0m (c, r, u modes only) Read sparse file information from disk. This is the reverse of 1m--no-read-sparse 22mand the default behav‐ ior. 1m-S 22m(x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similar to the conv=sparse op‐ tion of dd. 1m-s 4m22mpattern0m Modify file or archive member names according to 4mpattern24m. The pattern has the format 4m/old/new/24m[bghHprRsS] where 4mold24m is a ba‐ sic regular expression, 4mnew24m is the replacement string of the matched part, and the optional trailing letters modify how the replacement is handled. If 4mold24m is not matched, the pattern is skipped. Within 4mnew24m, ~ is substituted with the match, \1 to \9 with the content of the corresponding captured group. The op‐ tional trailing g specifies that matching should continue after the matched part and stop on the first unmatched pattern. The optional trailing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies that after a successful substitution the original path name and the new path name should be printed to standard error. The op‐ tional trailing b specifies that the substitution should be matched from the beginning of the string rather than from right after the position at which the previous matching substitution ended. Optional trailing H, R, or S characters suppress sub‐ stitutions for hardlink targets, regular filenames, or symlink targets, respectively. Optional trailing h, r, or s characters enable substitutions for hardlink targets, regular filenames, or symlink targets, respectively. The default is 4mhrs24m which ap‐ plies substitutions to all names. In particular, it is never necessary to specify h, r, or s. 1m--safe-writes0m (x mode only) Extract files atomically. By default 1mtar 22munlinks the original file with the same name as the extracted file (if it exists), and then creates it immediately under the same name and writes to it. For a short period of time, applications trying to access the file might not find it, or see incomplete results. If 1m--safe-writes 22mis enabled, 1mtar 22mfirst creates a unique temporary file, then writes the new contents to the tem‐ porary file, and finally renames the temporary file to its fi‐ nal name atomically using 4mrename24m(2). This guarantees that an application accessing the file, will either see the old con‐ tents or the new contents at all times. 1m--same-owner0m (x mode only) Extract owner and group IDs. This is the reverse of 1m--no-same-owner 22mand the default behavior if 1mtar 22mis run as root. 1m--strip-components 4m22mcount0m Remove the specified number of leading path elements. Path‐ names with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion pat‐ terns but before security checks. 1m-T 4m22mfilename24m, 1m--files-from 4m22mfilename0m In x or t mode, 1mtar 22mwill read the list of names to be extracted from 4mfilename24m. In c mode, 1mtar 22mwill read names to be archived from 4mfilename24m. The special name “-C” on a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by new‐ lines unless 1m--null 22mis specified. Note that 1m--null 22malso dis‐ ables the special handling of lines containing “-C”. Note: If you are generating lists of files using 4mfind24m(1), you probably want to use 1m-n 22mas well. 1m--totals0m (c, r, u modes only) After archiving all files, print a summary to stderr. 1m-U22m, 1m--unlink22m, 1m--unlink-first0m (x mode only) Unlink files before creating them. This can be a minor performance optimization if most files already exist, but can make things slower if most files do not already exist. This flag also causes 1mtar 22mto remove intervening directory sym‐ links instead of reporting an error. See the SECURITY section below for more details. 1m--uid 4m22mid0m Use the provided user id number and ignore the user name from the archive. On create, if 1m--uname 22mis not also specified, the user name will be set to match the user id. 1m--uname 4m22mname0m Use the provided user name. On extract, this overrides the user name in the archive; if the provided user name does not exist on the system, it will be ignored and the user id (from the archive or from the 1m--uid 22moption) will be used instead. On create, this sets the user name that will be stored in the archive; the name is not verified against the system user data‐ base. 1m--use-compress-program 4m22mprogram0m Pipe the input (in x or t mode) or the output (in c mode) through 4mprogram24m instead of using the builtin compression sup‐ port. 1m--owner 4m22mname24m[:4muid24m] Use the provided user, if 4muid24m is not provided, 4mname24m can be ei‐ ther an username or numeric id. See the 1m--uname 22moption for de‐ tails. 1m-v22m, 1m--verbose0m Produce verbose output. In create and extract modes, 1mtar 22mwill list each file name as it is read from or written to the archive. In list mode, 1mtar 22mwill produce output similar to that of 4mls24m(1). An additional 1m-v 22moption will also provide ls-like details in create and extract mode. 1m--version0m Print version of 1mtar 22mand 1mlibarchive22m, and exit. 1m-w22m, 1m--confirmation22m, 1m--interactive0m Ask for confirmation for every action. 1m-X 4m22mfilename24m, 1m--exclude-from 4m22mfilename0m Read a list of exclusion patterns from the specified file. See 1m--exclude 22mfor more information about the handling of exclu‐ sions. 1m--xattrs0m (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of 1m--no-xattrs 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. 1m-y 22m(c mode only) Compress the resulting archive with 4mbzip224m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically when reading archives. 1m-Z22m, 1m--compress22m, 1m--uncompress0m (c mode only) Compress the resulting archive with 4mcompress24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes compress compression auto‐ matically when reading archives. 1m-z22m, 1m--gunzip22m, 1m--gzip0m (c mode only) Compress the resulting archive with 4mgzip24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes gzip compression automatically when reading archives. 1mENVIRONMENT0m The following environment variables affect the execution of 1mtar22m: TAR_READER_OPTIONS The default options for format readers and compression readers. The 1m--options 22moption overrides this. TAR_WRITER_OPTIONS The default options for format writers and compression writers. The 1m--options 22moption overrides this. LANG The locale to use. See 4menviron24m(7) for more information. TAPE The default device. The 1m-f 22moption overrides this. Please see the description of the 1m-f 22moption above for more details. TZ The timezone to use when displaying dates. See 4menviron24m(7) for more information. 1mEXIT STATUS0m The 1mtar 22mutility exits 0 on success, and >0 if an error occurs. 1mEXAMPLES0m The following creates a new archive called 4mfile.tar.gz24m that contains two files 4msource.c24m and 4msource.h24m: 1mtar -czf 4m22mfile.tar.gz24m 4msource.c24m 4msource.h0m To view a detailed table of contents for this archive: 1mtar -tvf 4m22mfile.tar.gz0m To extract all entries from the archive on the default tape drive: 1mtar -x0m To examine the contents of an ISO 9660 cdrom image: 1mtar -tf 4m22mimage.iso0m To move file hierarchies, invoke 1mtar 22mas 1mtar -cf 4m22m-24m 1m-C 4m22msrcdir24m 4m.24m | 1mtar -xpf 4m22m-24m 1m-C 4m22mdestdir0m or more traditionally 1mcd srcdir ; tar -cf 4m22m-24m 4m.24m | (4mcd24m 4mdestdir24m 4m;24m 1mtar -xpf 4m22m-24m) In create mode, the list of files and directories to be archived can also include directory change instructions of the form 1m-C4m22mfoo/baz24m and archive inclusions of the form 1m@@4m22marchive-file24m. For example, the command line 1mtar -c -f 4m22mnew.tar24m 4mfoo124m 1m@@4m22mold.tgz24m 1m-C4m22m/tmp24m 4mfoo20m will create a new archive 4mnew.tar24m. 1mtar 22mwill read the file 4mfoo124m from the current directory and add it to the output archive. It will then read each entry from 4mold.tgz24m and add those entries to the output archive. Finally, it will switch to the 4m/tmp24m directory and add 4mfoo224m to the output archive. An input file in 4mmtree24m(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ from existing data on disk: $ cat input.mtree #mtree usr/bin uid=0 gid=0 mode=0755 type=dir usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls $ tar -cvf output.tar @@input.mtree The 1m--newer 22mand 1m--newer-mtime 22mswitches accept a variety of common date and time specifications, including “12 Mar 2005 7:14:29pm”, “2005-03-12 19:14”, “5 minutes ago”, and “19:14 PST May 1”. The 1m--options 22margument can be used to control various details of archive generation or reading. For example, you can generate mtree output which only contains 1mtype22m, 1mtime22m, and 1muid 22mkeywords: 1mtar -cf 4m22mfile.tar24m 1m--format=mtree --options='!all,type,time,uid'0m 4mdir0m or you can set the compression level used by gzip or xz compression: 1mtar -czf 4m22mfile.tar24m 1m--options='compression-level=9'22m. For more details, see the explanation of the 1marchive_read_set_options22m() and 1marchive_write_set_options22m() API calls that are described in 4marchive_read24m(3) and 4marchive_write24m(3). 1mCOMPATIBILITY0m The bundled-arguments format is supported for compatibility with his‐ toric implementations. It consists of an initial word (with no leading - character) in which each character indicates an option. Arguments follow as separate words. The order of the arguments must match the order of the corresponding characters in the bundled command word. For example, 1mtar tbf 32 4m22mfile.tar0m specifies three flags 1mt22m, 1mb22m, and 1mf22m. The 1mb 22mand 1mf 22mflags both require ar‐ guments, so there must be two additional items on the command line. The 4m3224m is the argument to the 1mb 22mflag, and 4mfile.tar24m is the argument to the 1mf 22mflag. The mode options c, r, t, u, and x and the options b, f, l, m, o, v, and w comply with SUSv2. For maximum portability, scripts that invoke 1mtar 22mshould use the bun‐ dled-argument format above, should limit themselves to the 1mc22m, 1mt22m, and 1mx0m modes, and the 1mb22m, 1mf22m, 1mm22m, 1mv22m, and 1mw 22moptions. Additional long options are provided to improve compatibility with other tar implementations. 1mSECURITY0m Certain security issues are common to many archiving programs, includ‐ ing 1mtar22m. In particular, carefully-crafted archives can request that 1mtar 22mextract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files they did not intend to overwrite. If the archive is being extracted by the superuser, any file on the system can potentially be overwritten. There are three ways this can happen. Although 1mtar 22mhas mechanisms to protect against each one, savvy users should be aware of the implica‐ tions: 1m• 22mArchive entries can have absolute pathnames. By default, 1mtar0m removes the leading 4m/24m character from filenames before restoring them to guard against this problem. 1m• 22mArchive entries can have pathnames that include 4m..24m components. By default, 1mtar 22mwill not extract files containing 4m..24m components in their pathname. 1m• 22mArchive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that directory. To guard against this, 1mtar 22mchecks each ex‐ tracted path for symlinks. If the final path element is a sym‐ link, it will be removed and replaced with the archive entry. If 1m-U 22mis specified, any intermediate symlink will also be un‐ conditionally removed. If neither 1m-U 22mnor 1m-P 22mis specified, 1mtar0m will refuse to extract the entry. To protect yourself, you should be wary of any archives that come from untrusted sources. You should examine the contents of an archive with 1mtar -tf 4m22mfilename0m before extraction. You should use the 1m-k 22moption to ensure that 1mtar0m will not overwrite any existing files or the 1m-U 22moption to remove any pre-existing files. You should generally not extract archives while running with super-user privileges. Note that the 1m-P 22moption to 1mtar0m disables the security checks above and allows you to extract an archive while preserving any absolute pathnames, 4m..24m components, or symlinks to other directories. 1mSEE ALSO0m 4mbzip224m(1), 4mcompress24m(1), 4mcpio24m(1), 4mgzip24m(1), 4mmt24m(1), 4mpax24m(1), 4mshar24m(1), 4mxz24m(1), 4mlibarchive24m(3), 4mlibarchive-formats24m(5), 4mtar24m(5) 1mSTANDARDS0m There is no current POSIX standard for the tar command; it appeared in ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation were developed by surveying a number of existing tar implementations as well as the old POSIX specification for tar and the current POSIX spec‐ ification for pax. The ustar and pax interchange file formats are defined by IEEE Std 1003.1-2001 (“POSIX.1”) for the pax command. 1mHISTORY0m A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in January, 1979. There have been numerous other implementations, many of which extended the file format. John Gilmore's 1mpdtar 22mpublic-domain im‐ plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in FreeBSD beginning with FreeBSD 1.0. This is a complete re-implementation based on the 4mlibarchive24m(3) li‐ brary. It was first released with FreeBSD 5.4 in May, 2005. 1mBUGS0m This program follows ISO/IEC 9945-1:1996 (“POSIX.1”) for the definition of the 1m-l 22moption. Note that GNU tar prior to version 1.15 treated 1m-l0m as a synonym for the 1m--one-file-system 22moption. The 1m-C 4m22mdir24m option may differ from historic implementations. All archive output is written in correctly-sized blocks, even if the output is being compressed. Whether or not the last output block is padded to a full block size varies depending on the format and the out‐ put device. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many compressors, including 4mgzip24m(1) and 4mbzip224m(1), complain about the null padding when decompressing an archive created by 1mtar22m, although they still extract it correctly. The compression and decompression is implemented internally, so there may be insignificant differences between the compressed output gener‐ ated by 1mtar -czf 4m22m-24m 4mfile0m and that generated by 1mtar -cf 4m22m-24m 4mfile24m | 1mgzip0m The default should be to read and write archives to the standard I/O paths, but tradition (and POSIX) dictates otherwise. The 1mr 22mand 1mu 22mmodes require that the archive be uncompressed and located in a regular file on disk. Other archives can be modified using 1mc 22mmode with the 4m@@archive-file24m extension. To archive a file called 4m@@foo24m or 4m-foo24m you must specify it as 4m./@@foo24m or 4m./-foo24m, respectively. In create mode, a leading 4m./24m is always removed. A leading 4m/24m is stripped unless the 1m-P 22moption is specified. There needs to be better support for file selection on both create and extract. There is not yet any support for multi-volume archives. Converting between dissimilar archive formats (such as tar and cpio) using the 1m@@4m22m-24m convention can cause hard link information to be lost. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) d896 1 a896 1 Debian April 23, 2024 4mTAR24m(1) @ 1.1.1.15 log @libarchive: imported version 3.7.9 @ text @d14 3 a16 3 tion can extract from tar, pax, cpio, zip, jar, ar, xar, rar, rpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 7-zip, and shar archives. d19 2 a20 2 provided for compatibility with historical implementations. See “COMPATIBILITY” below for details. a23 1 a58 1 a59 1 a61 1 a62 1 a63 1 a64 1 a72 1 a73 1 a75 1 a76 1 a78 1 a79 1 a80 1 a81 1 a83 1 a84 1 a193 1 a194 1 d266 2 a267 2 only for pax formats (including pax restricted, the default tar format for 1mbsdtar22m) d273 1 a273 1 (c, r, u modes only) Only include files and directories newer d281 1 a281 1 (c, r, u modes only) Only include files and directories newer d285 1 a285 1 (c, r, u modes only) Like 1m--newer-than22m, except it compares d289 1 a289 1 (c and r modes only) Honor the nodump file flag by skipping d293 3 a295 3 (x mode only) Mac OS X specific (v10.6 or later). Do not com‐ press extracted regular files which were compressed with HFS+ compression before archived. By default, compress the regular d299 1 a299 1 characters, not by newlines. This is often used to read file‐ d303 3 a305 3 (c, r, u, x modes only) Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of 1m--acls 22mand the default be‐ havior if 1mtar 22mis run as non-root in x mode (on Mac OS X as any d309 2 a310 2 (c, r, u, x modes only) Do not archive or extract file attrib‐ utes or file flags. This is the reverse of 1m--fflags 22mand the d314 2 a315 2 (x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using 4mcopyfile24m(3) in Apple‐ d320 1 a320 1 (c, r, u modes only) Do not read sparse file information from d324 2 a325 2 (x mode only) Do not create temporary files and use 4mrename24m(2) to replace the original ones. This is the reverse of d329 2 a330 2 (x mode only) Do not extract owner and group IDs. This is the reverse of 1m--same-owner 22mand the default behavior if 1mtar 22mis run d334 3 a336 3 (x mode only) Do not extract full permissions (SGID, SUID, sticky bit, file attributes or file flags, extended file at‐ tributes and ACLs). This is the reverse of 1m-p 22mand the default d341 1 a341 1 attributes. This is the reverse of 1m--xattrs 22mand the default d345 1 a345 1 This is equivalent to 1m--uname 22m"" 1m--gname 22m"". On extract, it d347 1 a347 1 vor of the numeric user and group ids. On create, it causes d351 3 a353 3 (x, t modes only) In extract (-x) mode, files will be written to standard out rather than being extracted to disk. In list (-t) mode, the file listing will be written to stderr rather d358 3 a360 3 no significance unless 1m-p 22mis specified, and the program is be‐ ing run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner in‐ d366 1 a366 1 (c, r, u modes only) Only include files and directories older d374 1 a374 1 (c, r, u modes only) Only include files and directories older d378 1 a378 1 (c, r, u modes only) Like 1m--older-than22m, except it compares d386 3 a388 3 is a text string containing comma-separated keywords and val‐ ues. These are passed to the modules that handle particular formats to control how those formats will behave. Each option a389 1 d391 2 a392 2 The key will be set to the specified value in every module that supports it. Modules that do not support d394 1 a394 1 4mkey24m The key will be enabled in every module that supports d396 1 a396 1 4m!key24m The key will be disabled in every module that supports d399 1 a399 1 As above, but the corresponding key and value will be d402 1 a402 1 The complete list of supported modules and keys for create and a406 1 d411 1 a411 1 Support Rock Ridge extensions. This is enabled by de‐ d414 1 a414 1 A decimal integer from 1 to 9 specifying the gzip com‐ d417 1 a417 1 Store timestamp. This is enabled by default, use d420 2 a421 2 Use 4mtype24m as compression method. Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, ex‐ d427 1 a427 1 A decimal integer from 1 to 9 specifying the lzop com‐ d435 1 a435 1 A decimal integer from 4 to 7 specifying the lz4 com‐ d438 1 a438 1 Use the previous block of the block being compressed d446 2 a447 2 Specify the number of worker threads to use, or 0 to use as many threads as there are CPU cores in the sys‐ d450 1 a450 1 Start a new compression frame at the beginning of each d454 3 a456 3 new compression frame unless the uncompressed size of the current frame is at least 4mN24m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, or 1mG / GB 22mto indicate d461 1 a461 1 current frame is at least 4mN24m bytes. The number may be d466 2 a467 2 the uncompressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, d472 2 a473 2 the compressed size of the current frame exceeds 4mN0m bytes. The number may be followed by 1mk / kB22m, 1mM / MB22m, d477 1 a477 1 A decimal integer from 1 to 9 specifying the lzop com‐ d480 1 a480 1 A decimal integer from 0 to 9 specifying the xz com‐ d483 2 a484 2 Specify the number of worker threads to use. Setting threads to a special value 0 makes 4mxz24m(1) use as many d487 6 a492 6 The mtree writer module allows you to specify which mtree keywords will be included in the output. Sup‐ ported keywords include: 1mcksum22m, 1mdevice22m, 1mflags22m, 1mgid22m, 1mgname22m, 1mindent22m, 1mlink22m, 1mmd522m, 1mmode22m, 1mnlink22m, 1mrmd16022m, 1msha122m, 1msha25622m, 1msha38422m, 1msha51222m, 1msize22m, 1mtime22m, 1muid22m, 1muname22m. The default is equivalent to: “device, flags, gid, gname, d495 1 a495 1 Enables all of the above keywords. You can also use d500 1 a500 1 Produce human-readable output by indenting options and d503 1 a503 1 Use 4mtype24m as compression method. Supported values are d508 3 a510 3 Use 4mtype24m as encryption type. Supported values are zipcrypt (traditional zip encryption), aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryp‐ d513 4 a516 4 Ignore zeroed blocks in the archive, which occurs when multiple tar archives have been concatenated together. Without this option, only the contents of the first concatenated archive would be read. This option is d518 1 a518 2 If a provided option is not supported by any module, that is a d523 4 a526 4 begin with a / character) have the leading slash removed both when creating archives and extracting from them. Also, 1mtar0m will refuse to extract archive entries whose pathnames contain 4m..24m or whose target directory would be altered by a symlink. d530 4 a533 4 (x mode only) Preserve file permissions. Attempt to restore the full permissions, including file modes, file attributes or file flags, extended file attributes and ACLs, if available, for each item extracted from the archive. This is the reverse d535 1 a535 1 root. It can be partially overridden by also specifying d539 1 a539 1 The 4mpassphrase24m is used to extract or create an encrypted d548 6 a553 6 (x and t mode only) Extract or list only the first archive en‐ try that matches each pattern or filename operand. Exit as soon as each specified pattern or filename has been matched. By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by con‐ vention, later entries overwrite earlier entries. This option d557 2 a558 2 (c, r, u modes only) Read sparse file information from disk. This is the reverse of 1m--no-read-sparse 22mand the default behav‐ d561 3 a563 3 1m-S 22m(x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it otherwise. This works similar to the conv=sparse op‐ d567 5 a571 5 Modify file or archive member names according to 4mpattern24m. The pattern has the format 4m/old/new/24m[bghHprRsS] where 4mold24m is a ba‐ sic regular expression, 4mnew24m is the replacement string of the matched part, and the optional trailing letters modify how the replacement is handled. If 4mold24m is not matched, the pattern is d573 1 a573 1 with the content of the corresponding captured group. The op‐ d575 3 a577 3 the matched part and stop on the first unmatched pattern. The optional trailing s specifies that the pattern applies to the value of symbolic links. The optional trailing p specifies d580 1 a580 1 tional trailing b specifies that the substitution should be d582 3 a584 3 after the position at which the previous matching substitution ended. Optional trailing H, R, or S characters suppress sub‐ stitutions for hardlink targets, regular filenames, or symlink d586 1 a586 1 enable substitutions for hardlink targets, regular filenames, d588 1 a588 1 plies substitutions to all names. In particular, it is never d593 1 a593 1 the original file with the same name as the extracted file (if d595 3 a597 3 and writes to it. For a short period of time, applications trying to access the file might not find it, or see incomplete results. If 1m--safe-writes 22mis enabled, 1mtar 22mfirst creates a d599 3 a601 3 porary file, and finally renames the temporary file to its fi‐ nal name atomically using 4mrename24m(2). This guarantees that an application accessing the file, will either see the old con‐ d606 1 a606 1 of 1m--no-same-owner 22mand the default behavior if 1mtar 22mis run as d610 3 a612 3 Remove the specified number of leading path elements. Path‐ names with fewer elements will be silently skipped. Note that the pathname is edited after checking inclusion/exclusion pat‐ d617 5 a621 5 from 4mfilename24m. In c mode, 1mtar 22mwill read names to be archived from 4mfilename24m. The special name “-C” on a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by new‐ lines unless 1m--null 22mis specified. Note that 1m--null 22malso dis‐ d623 1 a623 1 you are generating lists of files using 4mfind24m(1), you probably d633 4 a636 4 can make things slower if most files do not already exist. This flag also causes 1mtar 22mto remove intervening directory sym‐ links instead of reporting an error. See the “SECURITY” sec‐ tion below for more details. d639 2 a640 2 Use the provided user id number and ignore the user name from the archive. On create, if 1m--uname 22mis not also specified, the d644 3 a646 3 Use the provided user name. On extract, this overrides the user name in the archive; if the provided user name does not exist on the system, it will be ignored and the user id (from d648 1 a648 1 create, this sets the user name that will be stored in the d653 2 a654 2 Pipe the input (in x or t mode) or the output (in c mode) through 4mprogram24m instead of using the builtin compression sup‐ d658 1 a658 1 Use the provided user, if 4muid24m is not provided, 4mname24m can be ei‐ d663 2 a664 2 Produce verbose output. In create and extract modes, 1mtar 22mwill list each file name as it is read from or written to the d666 1 a666 1 of 4mls24m(1). An additional 1m-v 22moption will also provide ls-like d677 1 a677 1 1m--exclude 22mfor more information about the handling of exclu‐ d681 3 a683 3 (c, r, u, x modes only) Archive or extract extended file at‐ tributes. This is the reverse of 1m--no-xattrs 22mand the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as d687 2 a688 2 extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically d692 3 a694 3 (c mode only) Compress the resulting archive with 4mcompress24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes compress compression auto‐ d698 3 a700 3 (c mode only) Compress the resulting archive with 4mgzip24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes gzip compression automatically d716 1 a716 1 TAPE The default device. The 1m-f 22moption overrides this. Please see d719 1 a719 1 TZ The timezone to use when displaying dates. See 4menviron24m(7) for d726 1 a726 1 The following creates a new archive called 4mfile.tar.gz24m that contains a727 1 a730 1 a733 1 a736 1 a739 1 a740 1 a741 1 d744 2 a745 2 In create mode, the list of files and directories to be archived can also include directory change instructions of the form 1m-C4m22mfoo/baz24m and a747 1 d749 3 a751 4 will create a new archive 4mnew.tar24m. 1mtar 22mwill read the file 4mfoo124m from the current directory and add it to the output archive. It will then read each entry from 4mold.tgz24m and add those entries to the output d755 2 a756 2 An input file in 4mmtree24m(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ d765 1 a765 1 The 1m--newer 22mand 1m--newer-mtime 22mswitches accept a variety of common date d769 2 a770 2 The 1m--options 22margument can be used to control various details of archive generation or reading. For example, you can generate mtree d772 1 a772 2 1mtar -cf 4m22mfile.tar24m 1m--format=mtree --options='!all,type,time,uid'0m a773 1 a774 1 a775 1 d777 1 a777 1 and 1marchive_write_set_options22m() API calls that are described in d781 1 a781 1 The bundled-arguments format is supported for compatibility with his‐ d783 2 a784 2 - character) in which each character indicates an option. Arguments follow as separate words. The order of the arguments must match the a786 1 d788 3 a790 4 specifies three flags 1mt22m, 1mb22m, and 1mf22m. The 1mb 22mand 1mf 22mflags both require ar‐ guments, so there must be two additional items on the command line. The 4m3224m is the argument to the 1mb 22mflag, and 4mfile.tar24m is the argument to d793 1 a793 1 The mode options c, r, t, u, and x and the options b, f, l, m, o, v, d796 2 a797 2 For maximum portability, scripts that invoke 1mtar 22mshould use the bun‐ dled-argument format above, should limit themselves to the 1mc22m, 1mt22m, and 1mx0m d800 1 a800 1 Additional long options are provided to improve compatibility with d804 4 a807 4 Certain security issues are common to many archiving programs, includ‐ ing 1mtar22m. In particular, carefully-crafted archives can request that 1mtar 22mextract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files d809 3 a811 3 the superuser, any file on the system can potentially be overwritten. There are three ways this can happen. Although 1mtar 22mhas mechanisms to protect against each one, savvy users should be aware of the implica‐ d814 1 a814 1 1m• 22mArchive entries can have absolute pathnames. By default, 1mtar0m d818 1 a818 1 1m• 22mArchive entries can have pathnames that include 4m..24m components. d822 4 a825 4 1m• 22mArchive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that directory. To guard against this, 1mtar 22mchecks each ex‐ d827 3 a829 3 link, it will be removed and replaced with the archive entry. If 1m-U 22mis specified, any intermediate symlink will also be un‐ conditionally removed. If neither 1m-U 22mnor 1m-P 22mis specified, 1mtar0m d831 1 a831 2 To protect yourself, you should be wary of any archives that come from a832 1 d834 4 a837 5 before extraction. You should use the 1m-k 22moption to ensure that 1mtar0m will not overwrite any existing files or the 1m-U 22moption to remove any pre-existing files. You should generally not extract archives while running with super-user privileges. Note that the 1m-P 22moption to 1mtar0m d839 1 a839 1 while preserving any absolute pathnames, 4m..24m components, or symlinks to d847 3 a849 3 There is no current POSIX standard for the tar command; it appeared in ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001 (“POSIX.1”). The options supported by this implementation d854 1 a854 1 The ustar and pax interchange file formats are defined by IEEE Std d858 1 a858 1 A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in d861 2 a862 2 plementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar d865 1 a865 1 This is a complete re-implementation based on the 4mlibarchive24m(3) li‐ d870 1 a870 1 of the 1m-l 22moption. Note that GNU tar prior to version 1.15 treated 1m-l0m d875 2 a876 2 All archive output is written in correctly-sized blocks, even if the output is being compressed. Whether or not the last output block is d878 6 a883 6 put device. For tar and cpio formats, the last block of output is padded to a full block size if the output is being written to standard output or to a character or block device such as a tape drive. If the output is being written to a regular file, the last block will not be padded. Many compressors, including 4mgzip24m(1) and 4mbzip224m(1), complain about the null padding when decompressing an archive created by 1mtar22m, d886 2 a887 2 The compression and decompression is implemented internally, so there may be insignificant differences between the compressed output gener‐ a888 1 a889 1 a890 1 d893 1 a893 1 The default should be to read and write archives to the standard I/O d896 1 a896 1 The 1mr 22mand 1mu 22mmodes require that the archive be uncompressed and located d900 1 a900 1 To archive a file called 4m@@foo24m or 4m-foo24m you must specify it as 4m./@@foo24m or d903 1 a903 1 In create mode, a leading 4m./24m is always removed. A leading 4m/24m is d906 1 a906 1 There needs to be better support for file selection on both create and d911 4 a914 4 Converting between dissimilar archive formats (such as tar and cpio) using the 1m@@4m22m-24m convention can cause hard link information to be lost. This is a consequence of the incompatible ways that different archive formats store hardlink information. @ 1.1.1.16 log @libarchive: import version 3.8.0 Libarchive 3.8.0 is a feature and bugfix release. New features: bsdtar: support --mtime and --clamp-mtime lib: mbedtls 3.x compatibility 7-zip reader: improve self-extracting archive detection xar: xmllite support for the XAR reader and writer zip writer: added XZ, LZMA, ZSTD and BZIP2 support zip writer: added LZMA + RISCV BCJ filter Notable security fixes: rar: do not skip past EOF while reading rar: fix double free with over 4 billion nodes rar: fix heap-buffer-overflow warc: prevent signed integer overflow tar: fix overflow in build_ustar_entry Notable bugfixes: bsdtar: don't hardlink negative inode files together gz: allow setting the original filename for gzip compressed files lib: improve lseek handling lib: support @@-prefixed Unix epoch timestamps as date strings rar: support large headers on 32 bit systems tar reader: Improve LFS support on 32 bit systems @ text @a129 4 1m--clamp-mtime0m (use with 1m--mtime22m) Only set the modification time if the file is newer than the date specified in 1m--mtime22m. d131 2 a132 2 (x mode only) Before removing file system objects to replace them, clear platform-specific file attributes or file flags d136 1 a136 1 Do not process files or directories that match the specified d142 1 a142 1 sion control systems ‘Arch’, ‘Bazaar’, ‘CVS’, ‘Darcs’, d146 1 a146 1 (c, r, u, x modes only) Archive or extract platform-specific d152 3 a154 3 (c, r, u mode only) Use the specified format for the created archive. Supported formats include “cpio”, “pax”, “shar”, and “ustar”. Other formats may also be supported; see d156 2 a157 2 ported formats. In r and u modes, when extending an existing archive, the format specified here must be compatible with the d161 3 a163 3 Read the archive from or write the archive to the specified file. The filename can be 4m-24m for standard input or standard output. The default varies by system; on FreeBSD, the default d167 1 a167 1 Use the provided group id number. On extract, this overrides d169 2 a170 2 be ignored. On create, this overrides the group id read from disk; if 1m--gname 22mis not also specified, the group name will be d174 2 a175 2 Use the provided group name. On extract, this overrides the group name in the archive; if the provided group name does not d177 2 a178 2 1m--gid 22moption) will be used instead. On create, this sets the group name that will be stored in the archive; the name will d183 1 a183 1 ther a group name or numeric id. See the 1m--gname 22moption for d186 2 a187 2 1m-H 22m(c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not d197 1 a197 1 (x mode only) Mac OS X specific (v10.6 or later). Compress ex‐ d201 1 a201 1 An alias of 1m--options read_concatenated_archives 22mfor compati‐ d206 2 a207 2 tern. Note that exclusions specified with 1m--exclude 22mtake precedence over inclusions. If no inclusions are explicitly d214 1 a214 1 creates a new archive 4mnew.tar24m containing only the entries from d218 2 a219 2 (c mode only) Compress the resulting archive with 4mxz24m(1). In extract or list modes, this option is ignored. Note that this d225 2 a226 2 extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes bzip2 compression automatically d230 2 a231 2 (x mode only) Do not overwrite existing files. In particular, if a file appears more than once in an archive, later copies d235 1 a235 1 (x mode only) Do not overwrite existing files that are newer d240 1 a240 1 mally, symbolic links are archived as such. With this option, d244 1 a244 1 (c and r modes only) Issue a warning message unless all links d249 2 a250 2 extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lrzip compression automatically d254 2 a255 2 sion before writing it. In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes lz4 d258 1 a258 1 1m--zstd 22m(c mode only) Compress the archive with zstd-compatible com‐ d260 1 a260 1 tion is ignored. Note that this 1mtar 22mimplementation recognizes d263 3 a265 3 1m--lzma 22m(c mode only) Compress the resulting archive with the original LZMA algorithm. In extract or list modes, this option is ig‐ nored. Use of this option is discouraged and new archives d267 1 a267 1 mentation recognizes LZMA compression automatically when read‐ d270 3 a272 3 1m--lzop 22m(c mode only) Compress the resulting archive with 4mlzop24m(1). In extract or list modes, this option is ignored. Note that this 1mtar 22mimplementation recognizes LZO compression automatically d276 1 a276 1 (x mode only) Do not extract modification time. By default, d280 5 a284 5 (c, r, u and x mode only) Mac OS X specific. Archive or ex‐ tract extended ACLs and extended file attributes using 4mcopyfile24m(3) in AppleDouble format. This is the reverse of 1m--no-mac-metadata22m. and the default behavior in c, r, and u modes or if 1mtar 22mis run in x mode as root. Currently supported a287 4 1m--mtime 4m22mdate0m (c, r, u modes only) Set the modification times of added files to the specified date. d333 4 a336 4 (c, r, u and x mode only) Mac OS X specific. Do not archive or extract ACLs and extended file attributes using 4mcopyfile24m(3) in AppleDouble format. This is the reverse of 1m--mac-metadata22m. and the default behavior if 1mtar 22mis run as non-root in x mode. @