1caf54c4fSMartin Matuska.\" Copyright (c) 2003-2007 Tim Kientzle 264287048SMartin Matuska.\" Copyright (c) 2017 Martin Matuska 3caf54c4fSMartin Matuska.\" All rights reserved. 4caf54c4fSMartin Matuska.\" 5caf54c4fSMartin Matuska.\" Redistribution and use in source and binary forms, with or without 6caf54c4fSMartin Matuska.\" modification, are permitted provided that the following conditions 7caf54c4fSMartin Matuska.\" are met: 8caf54c4fSMartin Matuska.\" 1. Redistributions of source code must retain the above copyright 9caf54c4fSMartin Matuska.\" notice, this list of conditions and the following disclaimer. 10caf54c4fSMartin Matuska.\" 2. Redistributions in binary form must reproduce the above copyright 11caf54c4fSMartin Matuska.\" notice, this list of conditions and the following disclaimer in the 12caf54c4fSMartin Matuska.\" documentation and/or other materials provided with the distribution. 13caf54c4fSMartin Matuska.\" 14caf54c4fSMartin Matuska.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15caf54c4fSMartin Matuska.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16caf54c4fSMartin Matuska.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17caf54c4fSMartin Matuska.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18caf54c4fSMartin Matuska.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19caf54c4fSMartin Matuska.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20caf54c4fSMartin Matuska.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21caf54c4fSMartin Matuska.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22caf54c4fSMartin Matuska.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23caf54c4fSMartin Matuska.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24caf54c4fSMartin Matuska.\" SUCH DAMAGE. 25caf54c4fSMartin Matuska.\" 266c22d9efSMartin Matuska.\" $FreeBSD$ 27caf54c4fSMartin Matuska.\" 28f9762417SMartin Matuska.Dd January 31, 2020 296c95142eSMartin Matuska.Dt TAR 1 30caf54c4fSMartin Matuska.Os 31caf54c4fSMartin Matuska.Sh NAME 32caf54c4fSMartin Matuska.Nm tar 33caf54c4fSMartin Matuska.Nd manipulate tape archives 34caf54c4fSMartin Matuska.Sh SYNOPSIS 35caf54c4fSMartin Matuska.Nm 36caf54c4fSMartin Matuska.Op Ar bundled-flags Ao args Ac 37caf54c4fSMartin Matuska.Op Ao Ar file Ac | Ao Ar pattern Ac ... 38caf54c4fSMartin Matuska.Nm 39caf54c4fSMartin Matuska.Brq Fl c 40caf54c4fSMartin Matuska.Op Ar options 41caf54c4fSMartin Matuska.Op Ar files | Ar directories 42caf54c4fSMartin Matuska.Nm 43caf54c4fSMartin Matuska.Brq Fl r | Fl u 44caf54c4fSMartin Matuska.Fl f Ar archive-file 45caf54c4fSMartin Matuska.Op Ar options 46caf54c4fSMartin Matuska.Op Ar files | Ar directories 47caf54c4fSMartin Matuska.Nm 48caf54c4fSMartin Matuska.Brq Fl t | Fl x 49caf54c4fSMartin Matuska.Op Ar options 50caf54c4fSMartin Matuska.Op Ar patterns 51caf54c4fSMartin Matuska.Sh DESCRIPTION 52caf54c4fSMartin Matuska.Nm 53caf54c4fSMartin Matuskacreates and manipulates streaming archive files. 54c5d360f8SMartin MatuskaThis implementation can extract from tar, pax, cpio, zip, jar, ar, xar, 556c95142eSMartin Matuskarpm, 7-zip, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip, 566c95142eSMartin Matuska7-zip, and shar archives. 57caf54c4fSMartin Matuska.Pp 58caf54c4fSMartin MatuskaThe first synopsis form shows a 59caf54c4fSMartin Matuska.Dq bundled 60caf54c4fSMartin Matuskaoption word. 61caf54c4fSMartin MatuskaThis usage is provided for compatibility with historical implementations. 62caf54c4fSMartin MatuskaSee COMPATIBILITY below for details. 63caf54c4fSMartin Matuska.Pp 64caf54c4fSMartin MatuskaThe other synopsis forms show the preferred usage. 65caf54c4fSMartin MatuskaThe first option to 66caf54c4fSMartin Matuska.Nm 67caf54c4fSMartin Matuskais a mode indicator from the following list: 68caf54c4fSMartin Matuska.Bl -tag -compact -width indent 69caf54c4fSMartin Matuska.It Fl c 70caf54c4fSMartin MatuskaCreate a new archive containing the specified items. 71c5d360f8SMartin MatuskaThe long option form is 72c5d360f8SMartin Matuska.Fl Fl create . 73caf54c4fSMartin Matuska.It Fl r 74caf54c4fSMartin MatuskaLike 75caf54c4fSMartin Matuska.Fl c , 76caf54c4fSMartin Matuskabut new entries are appended to the archive. 77caf54c4fSMartin MatuskaNote that this only works on uncompressed archives stored in regular files. 78caf54c4fSMartin MatuskaThe 79caf54c4fSMartin Matuska.Fl f 80caf54c4fSMartin Matuskaoption is required. 81c5d360f8SMartin MatuskaThe long option form is 82c5d360f8SMartin Matuska.Fl Fl append . 83caf54c4fSMartin Matuska.It Fl t 84caf54c4fSMartin MatuskaList archive contents to stdout. 85c5d360f8SMartin MatuskaThe long option form is 86c5d360f8SMartin Matuska.Fl Fl list . 87caf54c4fSMartin Matuska.It Fl u 88caf54c4fSMartin MatuskaLike 89caf54c4fSMartin Matuska.Fl r , 90caf54c4fSMartin Matuskabut new entries are added only if they have a modification date 91caf54c4fSMartin Matuskanewer than the corresponding entry in the archive. 92caf54c4fSMartin MatuskaNote that this only works on uncompressed archives stored in regular files. 93caf54c4fSMartin MatuskaThe 94caf54c4fSMartin Matuska.Fl f 95caf54c4fSMartin Matuskaoption is required. 96c5d360f8SMartin MatuskaThe long form is 97c5d360f8SMartin Matuska.Fl Fl update . 98caf54c4fSMartin Matuska.It Fl x 99caf54c4fSMartin MatuskaExtract to disk from the archive. 100caf54c4fSMartin MatuskaIf a file with the same name appears more than once in the archive, 101caf54c4fSMartin Matuskaeach copy will be extracted, with later copies overwriting (replacing) 102caf54c4fSMartin Matuskaearlier copies. 103c5d360f8SMartin MatuskaThe long option form is 104c5d360f8SMartin Matuska.Fl Fl extract . 105caf54c4fSMartin Matuska.El 106caf54c4fSMartin Matuska.Pp 107caf54c4fSMartin MatuskaIn 108caf54c4fSMartin Matuska.Fl c , 109caf54c4fSMartin Matuska.Fl r , 110caf54c4fSMartin Matuskaor 111caf54c4fSMartin Matuska.Fl u 112caf54c4fSMartin Matuskamode, each specified file or directory is added to the 113caf54c4fSMartin Matuskaarchive in the order specified on the command line. 114caf54c4fSMartin MatuskaBy default, the contents of each directory are also archived. 115caf54c4fSMartin Matuska.Pp 116caf54c4fSMartin MatuskaIn extract or list mode, the entire command line 117caf54c4fSMartin Matuskais read and parsed before the archive is opened. 118caf54c4fSMartin MatuskaThe pathnames or patterns on the command line indicate 119caf54c4fSMartin Matuskawhich items in the archive should be processed. 120caf54c4fSMartin MatuskaPatterns are shell-style globbing patterns as 121caf54c4fSMartin Matuskadocumented in 122caf54c4fSMartin Matuska.Xr tcsh 1 . 123caf54c4fSMartin Matuska.Sh OPTIONS 124caf54c4fSMartin MatuskaUnless specifically stated otherwise, options are applicable in 125caf54c4fSMartin Matuskaall operating modes. 126caf54c4fSMartin Matuska.Bl -tag -width indent 127caf54c4fSMartin Matuska.It Cm @ Ns Pa archive 12864287048SMartin Matuska(c and r modes only) 129caf54c4fSMartin MatuskaThe specified archive is opened and the entries 130caf54c4fSMartin Matuskain it will be appended to the current archive. 131caf54c4fSMartin MatuskaAs a simple example, 132caf54c4fSMartin Matuska.Dl Nm Fl c Fl f Pa - Pa newfile Cm @ Ns Pa original.tar 133caf54c4fSMartin Matuskawrites a new archive to standard output containing a file 134caf54c4fSMartin Matuska.Pa newfile 135caf54c4fSMartin Matuskaand all of the entries from 136caf54c4fSMartin Matuska.Pa original.tar . 137caf54c4fSMartin MatuskaIn contrast, 138caf54c4fSMartin Matuska.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar 139caf54c4fSMartin Matuskacreates a new archive with only two entries. 140caf54c4fSMartin MatuskaSimilarly, 141c5d360f8SMartin Matuska.Dl Nm Fl czf Pa - Fl Fl format Cm pax Cm @ Ns Pa - 142caf54c4fSMartin Matuskareads an archive from standard input (whose format will be determined 143caf54c4fSMartin Matuskaautomatically) and converts it into a gzip-compressed 144caf54c4fSMartin Matuskapax-format archive on stdout. 145caf54c4fSMartin MatuskaIn this way, 146caf54c4fSMartin Matuska.Nm 147caf54c4fSMartin Matuskacan be used to convert archives from one format to another. 148acc60b03SMartin Matuska.It Fl a , Fl Fl auto-compress 149acc60b03SMartin Matuska(c mode only) 150acc60b03SMartin MatuskaUse the archive suffix to decide a set of the format and 151acc60b03SMartin Matuskathe compressions. 152acc60b03SMartin MatuskaAs a simple example, 153acc60b03SMartin Matuska.Dl Nm Fl a Fl cf Pa archive.tgz source.c source.h 154acc60b03SMartin Matuskacreates a new archive with restricted pax format and gzip compression, 155acc60b03SMartin Matuska.Dl Nm Fl a Fl cf Pa archive.tar.bz2.uu source.c source.h 156acc60b03SMartin Matuskacreates a new archive with restricted pax format and bzip2 compression 157acc60b03SMartin Matuskaand uuencode compression, 158acc60b03SMartin Matuska.Dl Nm Fl a Fl cf Pa archive.zip source.c source.h 159acc60b03SMartin Matuskacreates a new archive with zip format, 160acc60b03SMartin Matuska.Dl Nm Fl a Fl jcf Pa archive.tgz source.c source.h 161acc60b03SMartin Matuskaignores the 162acc60b03SMartin Matuska.Dq -j 163acc60b03SMartin Matuskaoption, and creates a new archive with restricted pax format 164acc60b03SMartin Matuskaand gzip compression, 165acc60b03SMartin Matuska.Dl Nm Fl a Fl jcf Pa archive.xxx source.c source.h 166acc60b03SMartin Matuskaif it is unknown suffix or no suffix, creates a new archive with 167acc60b03SMartin Matuskarestricted pax format and bzip2 compression. 16864287048SMartin Matuska.It Fl Fl acls 16964287048SMartin Matuska(c, r, u, x modes only) 170f057565eSMartin MatuskaArchive or extract POSIX.1e or NFSv4 ACLs. 171f057565eSMartin MatuskaThis is the reverse of 17264287048SMartin Matuska.Fl Fl no-acls 173e46d4714SMartin Matuskaand the default behavior in c, r, and u modes (except on Mac OS X) or if 17464287048SMartin Matuska.Nm 175f057565eSMartin Matuskais run in x mode as root. 176f057565eSMartin MatuskaOn Mac OS X this option translates extended ACLs to NFSv4 ACLs. 177f057565eSMartin MatuskaTo store extended ACLs the 17864287048SMartin Matuska.Fl Fl mac-metadata 17964287048SMartin Matuskaoption is preferred. 180c5d360f8SMartin Matuska.It Fl B , Fl Fl read-full-blocks 181c5d360f8SMartin MatuskaIgnored for compatibility with other 182c5d360f8SMartin Matuska.Xr tar 1 183c5d360f8SMartin Matuskaimplementations. 184c5d360f8SMartin Matuska.It Fl b Ar blocksize , Fl Fl block-size Ar blocksize 185caf54c4fSMartin MatuskaSpecify the block size, in 512-byte records, for tape drive I/O. 186caf54c4fSMartin MatuskaAs a rule, this argument is only needed when reading from or writing 187caf54c4fSMartin Matuskato tape drives, and usually not even then as the default block size of 188caf54c4fSMartin Matuska20 records (10240 bytes) is very common. 1896c95142eSMartin Matuska.It Fl C Ar directory , Fl Fl cd Ar directory , Fl Fl directory Ar directory 190caf54c4fSMartin MatuskaIn c and r mode, this changes the directory before adding 191caf54c4fSMartin Matuskathe following files. 192caf54c4fSMartin MatuskaIn x mode, change directories after opening the archive 193caf54c4fSMartin Matuskabut before extracting entries from the archive. 194c5d360f8SMartin Matuska.It Fl Fl chroot 195caf54c4fSMartin Matuska(x mode only) 196caf54c4fSMartin Matuska.Fn chroot 197caf54c4fSMartin Matuskato the current directory after processing any 198caf54c4fSMartin Matuska.Fl C 199caf54c4fSMartin Matuskaoptions and before extracting any files. 200cdf63a70SMartin Matuska.It Fl Fl clear-nochange-fflags 201cdf63a70SMartin Matuska(x mode only) 202cdf63a70SMartin MatuskaBefore removing file system objects to replace them, clear platform-specific 203fae5c36eSMartin Matuskafile attributes or file flags that might prevent removal. 204c5d360f8SMartin Matuska.It Fl Fl exclude Ar pattern 205caf54c4fSMartin MatuskaDo not process files or directories that match the 206caf54c4fSMartin Matuskaspecified pattern. 207caf54c4fSMartin MatuskaNote that exclusions take precedence over patterns or filenames 208caf54c4fSMartin Matuskaspecified on the command line. 20952c2bb75SMartin Matuska.It Fl Fl exclude-vcs 21052c2bb75SMartin MatuskaDo not process files or directories internally used by the 21152c2bb75SMartin Matuskaversion control systems 21252c2bb75SMartin Matuska.Sq Arch , 21352c2bb75SMartin Matuska.Sq Bazaar , 214f9762417SMartin Matuska.Sq CVS , 215f9762417SMartin Matuska.Sq Darcs , 216f9762417SMartin Matuska.Sq Mercurial , 217f9762417SMartin Matuska.Sq RCS , 218f9762417SMartin Matuska.Sq SCCS , 219f9762417SMartin Matuska.Sq SVN 22052c2bb75SMartin Matuskaand 221f9762417SMartin Matuska.Sq git . 22264287048SMartin Matuska.It Fl Fl fflags 22364287048SMartin Matuska(c, r, u, x modes only) 224fae5c36eSMartin MatuskaArchive or extract platform-specific file attributes or file flags. 225fae5c36eSMartin MatuskaThis is the reverse of 22664287048SMartin Matuska.Fl Fl no-fflags 22764287048SMartin Matuskaand the default behavior in c, r, and u modes or if 22864287048SMartin Matuska.Nm 22964287048SMartin Matuskais run in x mode as root. 230c5d360f8SMartin Matuska.It Fl Fl format Ar format 231caf54c4fSMartin Matuska(c, r, u mode only) 232caf54c4fSMartin MatuskaUse the specified format for the created archive. 233caf54c4fSMartin MatuskaSupported formats include 234caf54c4fSMartin Matuska.Dq cpio , 235caf54c4fSMartin Matuska.Dq pax , 236caf54c4fSMartin Matuska.Dq shar , 237caf54c4fSMartin Matuskaand 238caf54c4fSMartin Matuska.Dq ustar . 239caf54c4fSMartin MatuskaOther formats may also be supported; see 240caf54c4fSMartin Matuska.Xr libarchive-formats 5 241caf54c4fSMartin Matuskafor more information about currently-supported formats. 242caf54c4fSMartin MatuskaIn r and u modes, when extending an existing archive, the format specified 243caf54c4fSMartin Matuskahere must be compatible with the format of the existing archive on disk. 244c5d360f8SMartin Matuska.It Fl f Ar file , Fl Fl file Ar file 245caf54c4fSMartin MatuskaRead the archive from or write the archive to the specified file. 246caf54c4fSMartin MatuskaThe filename can be 247caf54c4fSMartin Matuska.Pa - 248caf54c4fSMartin Matuskafor standard input or standard output. 249c5d360f8SMartin MatuskaThe default varies by system; 250c5d360f8SMartin Matuskaon 251caf54c4fSMartin Matuska.Fx , 252c5d360f8SMartin Matuskathe default is 253c5d360f8SMartin Matuska.Pa /dev/sa0 ; 254c5d360f8SMartin Matuskaon Linux, the default is 255c5d360f8SMartin Matuska.Pa /dev/st0 . 256caf54c4fSMartin Matuska.It Fl Fl gid Ar id 257caf54c4fSMartin MatuskaUse the provided group id number. 258caf54c4fSMartin MatuskaOn extract, this overrides the group id in the archive; 259caf54c4fSMartin Matuskathe group name in the archive will be ignored. 260caf54c4fSMartin MatuskaOn create, this overrides the group id read from disk; 261caf54c4fSMartin Matuskaif 262caf54c4fSMartin Matuska.Fl Fl gname 263caf54c4fSMartin Matuskais not also specified, the group name will be set to 264caf54c4fSMartin Matuskamatch the group id. 265caf54c4fSMartin Matuska.It Fl Fl gname Ar name 266caf54c4fSMartin MatuskaUse the provided group name. 267caf54c4fSMartin MatuskaOn extract, this overrides the group name in the archive; 268caf54c4fSMartin Matuskaif the provided group name does not exist on the system, 269caf54c4fSMartin Matuskathe group id 270caf54c4fSMartin Matuska(from the archive or from the 271caf54c4fSMartin Matuska.Fl Fl gid 272caf54c4fSMartin Matuskaoption) 273caf54c4fSMartin Matuskawill be used instead. 274caf54c4fSMartin MatuskaOn create, this sets the group name that will be stored 275caf54c4fSMartin Matuskain the archive; 276caf54c4fSMartin Matuskathe name will not be verified against the system group database. 277caf54c4fSMartin Matuska.It Fl H 27864287048SMartin Matuska(c and r modes only) 279caf54c4fSMartin MatuskaSymbolic links named on the command line will be followed; the 280caf54c4fSMartin Matuskatarget of the link will be archived, not the link itself. 281caf54c4fSMartin Matuska.It Fl h 28264287048SMartin Matuska(c and r modes only) 283caf54c4fSMartin MatuskaSynonym for 284caf54c4fSMartin Matuska.Fl L . 285caf54c4fSMartin Matuska.It Fl I 286caf54c4fSMartin MatuskaSynonym for 287caf54c4fSMartin Matuska.Fl T . 288c5d360f8SMartin Matuska.It Fl Fl help 289c5d360f8SMartin MatuskaShow usage. 290acc60b03SMartin Matuska.It Fl Fl hfsCompression 291acc60b03SMartin Matuska(x mode only) 29264287048SMartin MatuskaMac OS X specific (v10.6 or later). Compress extracted regular files with HFS+ 29364287048SMartin Matuskacompression. 294cdf63a70SMartin Matuska.It Fl Fl ignore-zeros 295cdf63a70SMartin MatuskaAn alias of 296cdf63a70SMartin Matuska.Fl Fl options Cm read_concatenated_archives 297cdf63a70SMartin Matuskafor compatibility with GNU tar. 298c5d360f8SMartin Matuska.It Fl Fl include Ar pattern 299caf54c4fSMartin MatuskaProcess only files or directories that match the specified pattern. 300caf54c4fSMartin MatuskaNote that exclusions specified with 301c5d360f8SMartin Matuska.Fl Fl exclude 302caf54c4fSMartin Matuskatake precedence over inclusions. 303caf54c4fSMartin MatuskaIf no inclusions are explicitly specified, all entries are processed by 304caf54c4fSMartin Matuskadefault. 305caf54c4fSMartin MatuskaThe 306c5d360f8SMartin Matuska.Fl Fl include 307caf54c4fSMartin Matuskaoption is especially useful when filtering archives. 308caf54c4fSMartin MatuskaFor example, the command 309c5d360f8SMartin Matuska.Dl Nm Fl c Fl f Pa new.tar Fl Fl include='*foo*' Cm @ Ns Pa old.tgz 310caf54c4fSMartin Matuskacreates a new archive 311caf54c4fSMartin Matuska.Pa new.tar 312caf54c4fSMartin Matuskacontaining only the entries from 313caf54c4fSMartin Matuska.Pa old.tgz 314caf54c4fSMartin Matuskacontaining the string 315caf54c4fSMartin Matuska.Sq foo . 316c5d360f8SMartin Matuska.It Fl J , Fl Fl xz 317c5d360f8SMartin Matuska(c mode only) 318c5d360f8SMartin MatuskaCompress the resulting archive with 319c5d360f8SMartin Matuska.Xr xz 1 . 320c5d360f8SMartin MatuskaIn extract or list modes, this option is ignored. 3215c831a5bSMartin MatuskaNote that this 322c5d360f8SMartin Matuska.Nm tar 3235c831a5bSMartin Matuskaimplementation recognizes XZ compression automatically when reading archives. 324c5d360f8SMartin Matuska.It Fl j , Fl Fl bzip , Fl Fl bzip2 , Fl Fl bunzip2 325caf54c4fSMartin Matuska(c mode only) 326caf54c4fSMartin MatuskaCompress the resulting archive with 327caf54c4fSMartin Matuska.Xr bzip2 1 . 328caf54c4fSMartin MatuskaIn extract or list modes, this option is ignored. 3295c831a5bSMartin MatuskaNote that this 330caf54c4fSMartin Matuska.Nm tar 3315c831a5bSMartin Matuskaimplementation recognizes bzip2 compression automatically when reading 3325c831a5bSMartin Matuskaarchives. 333c5d360f8SMartin Matuska.It Fl k , Fl Fl keep-old-files 334caf54c4fSMartin Matuska(x mode only) 335caf54c4fSMartin MatuskaDo not overwrite existing files. 336caf54c4fSMartin MatuskaIn particular, if a file appears more than once in an archive, 337caf54c4fSMartin Matuskalater copies will not overwrite earlier copies. 338c5d360f8SMartin Matuska.It Fl Fl keep-newer-files 339caf54c4fSMartin Matuska(x mode only) 340caf54c4fSMartin MatuskaDo not overwrite existing files that are newer than the 341caf54c4fSMartin Matuskaversions appearing in the archive being extracted. 342c5d360f8SMartin Matuska.It Fl L , Fl Fl dereference 34364287048SMartin Matuska(c and r modes only) 344caf54c4fSMartin MatuskaAll symbolic links will be followed. 345caf54c4fSMartin MatuskaNormally, symbolic links are archived as such. 346caf54c4fSMartin MatuskaWith this option, the target of the link will be archived instead. 347c5d360f8SMartin Matuska.It Fl l , Fl Fl check-links 348c5d360f8SMartin Matuska(c and r modes only) 349c5d360f8SMartin MatuskaIssue a warning message unless all links to each file are archived. 350acc60b03SMartin Matuska.It Fl Fl lrzip 351acc60b03SMartin Matuska(c mode only) 352acc60b03SMartin MatuskaCompress the resulting archive with 353acc60b03SMartin Matuska.Xr lrzip 1 . 354acc60b03SMartin MatuskaIn extract or list modes, this option is ignored. 3555c831a5bSMartin MatuskaNote that this 3565c831a5bSMartin Matuska.Nm tar 3575c831a5bSMartin Matuskaimplementation recognizes lrzip compression automatically when reading 3585c831a5bSMartin Matuskaarchives. 359cdf63a70SMartin Matuska.It Fl Fl lz4 360cdf63a70SMartin Matuska(c mode only) 361cdf63a70SMartin MatuskaCompress the archive with lz4-compatible compression before writing it. 3625c831a5bSMartin MatuskaIn extract or list modes, this option is ignored. 3635c831a5bSMartin MatuskaNote that this 3645c831a5bSMartin Matuska.Nm tar 3655c831a5bSMartin Matuskaimplementation recognizes lz4 compression automatically when reading archives. 3665c831a5bSMartin Matuska.It Fl Fl zstd 3675c831a5bSMartin Matuska(c mode only) 3685c831a5bSMartin MatuskaCompress the archive with zstd-compatible compression before writing it. 3695c831a5bSMartin MatuskaIn extract or list modes, this option is ignored. 3705c831a5bSMartin MatuskaNote that this 3715c831a5bSMartin Matuska.Nm tar 3725c831a5bSMartin Matuskaimplementation recognizes zstd compression automatically when reading archives. 373c5d360f8SMartin Matuska.It Fl Fl lzma 374c5d360f8SMartin Matuska(c mode only) Compress the resulting archive with the original LZMA algorithm. 3755c831a5bSMartin MatuskaIn extract or list modes, this option is ignored. 376c5d360f8SMartin MatuskaUse of this option is discouraged and new archives should be created with 377c5d360f8SMartin Matuska.Fl Fl xz 378c5d360f8SMartin Matuskainstead. 3795c831a5bSMartin MatuskaNote that this 380c5d360f8SMartin Matuska.Nm tar 3815c831a5bSMartin Matuskaimplementation recognizes LZMA compression automatically when reading archives. 382acc60b03SMartin Matuska.It Fl Fl lzop 383acc60b03SMartin Matuska(c mode only) 384acc60b03SMartin MatuskaCompress the resulting archive with 385acc60b03SMartin Matuska.Xr lzop 1 . 386acc60b03SMartin MatuskaIn extract or list modes, this option is ignored. 3875c831a5bSMartin MatuskaNote that this 3885c831a5bSMartin Matuska.Nm tar 3895c831a5bSMartin Matuskaimplementation recognizes LZO compression automatically when reading archives. 390c5d360f8SMartin Matuska.It Fl m , Fl Fl modification-time 391caf54c4fSMartin Matuska(x mode only) 392caf54c4fSMartin MatuskaDo not extract modification time. 393caf54c4fSMartin MatuskaBy default, the modification time is set to the time stored in the archive. 39464287048SMartin Matuska.It Fl Fl mac-metadata 39564287048SMartin Matuska(c, r, u and x mode only) 396f057565eSMartin MatuskaMac OS X specific. 397f057565eSMartin MatuskaArchive or extract extended ACLs and extended file 398fae5c36eSMartin Matuskaattributes using 39964287048SMartin Matuska.Xr copyfile 3 400f057565eSMartin Matuskain AppleDouble format. 401f057565eSMartin MatuskaThis is the reverse of 40264287048SMartin Matuska.Fl Fl no-mac-metadata . 40364287048SMartin Matuskaand the default behavior in c, r, and u modes or if 40464287048SMartin Matuska.Nm 40564287048SMartin Matuskais run in x mode as root. 406c5d360f8SMartin Matuska.It Fl n , Fl Fl norecurse , Fl Fl no-recursion 40752c2bb75SMartin MatuskaDo not operate recursively on the content of directories. 408c5d360f8SMartin Matuska.It Fl Fl newer Ar date 409caf54c4fSMartin Matuska(c, r, u modes only) 410caf54c4fSMartin MatuskaOnly include files and directories newer than the specified date. 411caf54c4fSMartin MatuskaThis compares ctime entries. 412c5d360f8SMartin Matuska.It Fl Fl newer-mtime Ar date 413caf54c4fSMartin Matuska(c, r, u modes only) 414caf54c4fSMartin MatuskaLike 415c5d360f8SMartin Matuska.Fl Fl newer , 416caf54c4fSMartin Matuskaexcept it compares mtime entries instead of ctime entries. 417c5d360f8SMartin Matuska.It Fl Fl newer-than Pa file 418caf54c4fSMartin Matuska(c, r, u modes only) 419caf54c4fSMartin MatuskaOnly include files and directories newer than the specified file. 420caf54c4fSMartin MatuskaThis compares ctime entries. 421c5d360f8SMartin Matuska.It Fl Fl newer-mtime-than Pa file 422caf54c4fSMartin Matuska(c, r, u modes only) 423caf54c4fSMartin MatuskaLike 424c5d360f8SMartin Matuska.Fl Fl newer-than , 425caf54c4fSMartin Matuskaexcept it compares mtime entries instead of ctime entries. 426c5d360f8SMartin Matuska.It Fl Fl nodump 427caf54c4fSMartin Matuska(c and r modes only) 428caf54c4fSMartin MatuskaHonor the nodump file flag by skipping this file. 429acc60b03SMartin Matuska.It Fl Fl nopreserveHFSCompression 430acc60b03SMartin Matuska(x mode only) 431acc60b03SMartin MatuskaMac OS X specific (v10.6 or later). Do not compress extracted regular files 432acc60b03SMartin Matuskawhich were compressed with HFS+ compression before archived. 433acc60b03SMartin MatuskaBy default, compress the regular files again with HFS+ compression. 434c5d360f8SMartin Matuska.It Fl Fl null 435caf54c4fSMartin Matuska(use with 436c5d360f8SMartin Matuska.Fl I 437caf54c4fSMartin Matuskaor 438c5d360f8SMartin Matuska.Fl T ) 439caf54c4fSMartin MatuskaFilenames or patterns are separated by null characters, 440caf54c4fSMartin Matuskanot by newlines. 441caf54c4fSMartin MatuskaThis is often used to read filenames output by the 442caf54c4fSMartin Matuska.Fl print0 443caf54c4fSMartin Matuskaoption to 444caf54c4fSMartin Matuska.Xr find 1 . 44564287048SMartin Matuska.It Fl Fl no-acls 44664287048SMartin Matuska(c, r, u, x modes only) 447f057565eSMartin MatuskaDo not archive or extract POSIX.1e or NFSv4 ACLs. 448f057565eSMartin MatuskaThis is the reverse of 44964287048SMartin Matuska.Fl Fl acls 45064287048SMartin Matuskaand the default behavior if 45164287048SMartin Matuska.Nm 452e46d4714SMartin Matuskais run as non-root in x mode (on Mac OS X as any user in c, r, u and x modes). 45364287048SMartin Matuska.It Fl Fl no-fflags 45464287048SMartin Matuska(c, r, u, x modes only) 455f057565eSMartin MatuskaDo not archive or extract file attributes or file flags. 456f057565eSMartin MatuskaThis is the reverse of 45764287048SMartin Matuska.Fl Fl fflags 45864287048SMartin Matuskaand the default behavior if 45964287048SMartin Matuska.Nm 46064287048SMartin Matuskais run as non-root in x mode. 46164287048SMartin Matuska.It Fl Fl no-mac-metadata 46264287048SMartin Matuska(x mode only) 463f057565eSMartin MatuskaMac OS X specific. 464f057565eSMartin MatuskaDo not archive or extract ACLs and extended file attributes 465fae5c36eSMartin Matuskausing 46664287048SMartin Matuska.Xr copyfile 3 467f057565eSMartin Matuskain AppleDouble format. 468f057565eSMartin MatuskaThis is the reverse of 46964287048SMartin Matuska.Fl Fl mac-metadata . 47064287048SMartin Matuskaand the default behavior if 47164287048SMartin Matuska.Nm 47264287048SMartin Matuskais run as non-root in x mode. 473833a452eSMartin Matuska.It Fl Fl no-read-sparse 474833a452eSMartin Matuska(c, r, u modes only) 475833a452eSMartin MatuskaDo not read sparse file information from disk. 476833a452eSMartin MatuskaThis is the reverse of 477833a452eSMartin Matuska.Fl Fl read-sparse . 478f9762417SMartin Matuska.It Fl Fl no-safe-writes 479f9762417SMartin Matuska(x mode only) 480f9762417SMartin MatuskaDo not create temporary files and use 481f9762417SMartin Matuska.Xr rename 2 482f9762417SMartin Matuskato replace the original ones. 483f9762417SMartin MatuskaThis is the reverse of 484f9762417SMartin Matuska.Fl Fl safe-writes . 485caf54c4fSMartin Matuska.It Fl Fl no-same-owner 486caf54c4fSMartin Matuska(x mode only) 487caf54c4fSMartin MatuskaDo not extract owner and group IDs. 488caf54c4fSMartin MatuskaThis is the reverse of 489caf54c4fSMartin Matuska.Fl Fl same-owner 490caf54c4fSMartin Matuskaand the default behavior if 491caf54c4fSMartin Matuska.Nm 492caf54c4fSMartin Matuskais run as non-root. 493caf54c4fSMartin Matuska.It Fl Fl no-same-permissions 494caf54c4fSMartin Matuska(x mode only) 495fae5c36eSMartin MatuskaDo not extract full permissions (SGID, SUID, sticky bit, 496fae5c36eSMartin Matuskafile attributes or file flags, extended file attributes and ACLs). 497caf54c4fSMartin MatuskaThis is the reverse of 498caf54c4fSMartin Matuska.Fl p 499caf54c4fSMartin Matuskaand the default behavior if 500caf54c4fSMartin Matuska.Nm 501caf54c4fSMartin Matuskais run as non-root. 50264287048SMartin Matuska.It Fl Fl no-xattrs 50364287048SMartin Matuska(c, r, u, x modes only) 504f057565eSMartin MatuskaDo not archive or extract extended file attributes. 505f057565eSMartin MatuskaThis is the reverse of 50664287048SMartin Matuska.Fl Fl xattrs 50764287048SMartin Matuskaand the default behavior if 50864287048SMartin Matuska.Nm 50964287048SMartin Matuskais run as non-root in x mode. 510caf54c4fSMartin Matuska.It Fl Fl numeric-owner 511caf54c4fSMartin MatuskaThis is equivalent to 512caf54c4fSMartin Matuska.Fl Fl uname 513caf54c4fSMartin Matuska.Qq 514caf54c4fSMartin Matuska.Fl Fl gname 515caf54c4fSMartin Matuska.Qq . 516caf54c4fSMartin MatuskaOn extract, it causes user and group names in the archive 517caf54c4fSMartin Matuskato be ignored in favor of the numeric user and group ids. 518caf54c4fSMartin MatuskaOn create, it causes user and group names to not be stored 519caf54c4fSMartin Matuskain the archive. 520c5d360f8SMartin Matuska.It Fl O , Fl Fl to-stdout 521caf54c4fSMartin Matuska(x, t modes only) 522caf54c4fSMartin MatuskaIn extract (-x) mode, files will be written to standard out rather than 523caf54c4fSMartin Matuskabeing extracted to disk. 524caf54c4fSMartin MatuskaIn list (-t) mode, the file listing will be written to stderr rather than 525caf54c4fSMartin Matuskathe usual stdout. 526caf54c4fSMartin Matuska.It Fl o 527caf54c4fSMartin Matuska(x mode) 528caf54c4fSMartin MatuskaUse the user and group of the user running the program rather 529caf54c4fSMartin Matuskathan those specified in the archive. 530caf54c4fSMartin MatuskaNote that this has no significance unless 531caf54c4fSMartin Matuska.Fl p 532caf54c4fSMartin Matuskais specified, and the program is being run by the root user. 533caf54c4fSMartin MatuskaIn this case, the file modes and flags from 534caf54c4fSMartin Matuskathe archive will be restored, but ACLs or owner information in 535caf54c4fSMartin Matuskathe archive will be discarded. 536caf54c4fSMartin Matuska.It Fl o 537caf54c4fSMartin Matuska(c, r, u mode) 538caf54c4fSMartin MatuskaA synonym for 539c5d360f8SMartin Matuska.Fl Fl format Ar ustar 540acc60b03SMartin Matuska.It Fl Fl older Ar date 541acc60b03SMartin Matuska(c, r, u modes only) 542acc60b03SMartin MatuskaOnly include files and directories older than the specified date. 543acc60b03SMartin MatuskaThis compares ctime entries. 544acc60b03SMartin Matuska.It Fl Fl older-mtime Ar date 545acc60b03SMartin Matuska(c, r, u modes only) 546acc60b03SMartin MatuskaLike 547acc60b03SMartin Matuska.Fl Fl older , 548acc60b03SMartin Matuskaexcept it compares mtime entries instead of ctime entries. 549acc60b03SMartin Matuska.It Fl Fl older-than Pa file 550acc60b03SMartin Matuska(c, r, u modes only) 551acc60b03SMartin MatuskaOnly include files and directories older than the specified file. 552acc60b03SMartin MatuskaThis compares ctime entries. 553acc60b03SMartin Matuska.It Fl Fl older-mtime-than Pa file 554acc60b03SMartin Matuska(c, r, u modes only) 555acc60b03SMartin MatuskaLike 556acc60b03SMartin Matuska.Fl Fl older-than , 557acc60b03SMartin Matuskaexcept it compares mtime entries instead of ctime entries. 558c5d360f8SMartin Matuska.It Fl Fl one-file-system 559caf54c4fSMartin Matuska(c, r, and u modes) 560caf54c4fSMartin MatuskaDo not cross mount points. 561c5d360f8SMartin Matuska.It Fl Fl options Ar options 562caf54c4fSMartin MatuskaSelect optional behaviors for particular modules. 563caf54c4fSMartin MatuskaThe argument is a text string containing comma-separated 564caf54c4fSMartin Matuskakeywords and values. 565caf54c4fSMartin MatuskaThese are passed to the modules that handle particular 566caf54c4fSMartin Matuskaformats to control how those formats will behave. 567caf54c4fSMartin MatuskaEach option has one of the following forms: 568caf54c4fSMartin Matuska.Bl -tag -compact -width indent 569caf54c4fSMartin Matuska.It Ar key=value 570caf54c4fSMartin MatuskaThe key will be set to the specified value in every module that supports it. 571caf54c4fSMartin MatuskaModules that do not support this key will ignore it. 572caf54c4fSMartin Matuska.It Ar key 573caf54c4fSMartin MatuskaThe key will be enabled in every module that supports it. 574caf54c4fSMartin MatuskaThis is equivalent to 575caf54c4fSMartin Matuska.Ar key Ns Cm =1 . 576caf54c4fSMartin Matuska.It Ar !key 577caf54c4fSMartin MatuskaThe key will be disabled in every module that supports it. 578caf54c4fSMartin Matuska.It Ar module:key=value , Ar module:key , Ar module:!key 579caf54c4fSMartin MatuskaAs above, but the corresponding key and value will be provided 580caf54c4fSMartin Matuskaonly to modules whose name matches 581caf54c4fSMartin Matuska.Ar module . 582caf54c4fSMartin Matuska.El 583f9762417SMartin Matuska.Pp 584f9762417SMartin MatuskaThe complete list of supported modules and keys 585f9762417SMartin Matuskafor create and append modes is in 586f9762417SMartin Matuska.Xr archive_write_set_options 3 587f9762417SMartin Matuskaand for extract and list modes in 588f9762417SMartin Matuska.Xr archive_read_set_options 3 . 589f9762417SMartin Matuska.Pp 590f9762417SMartin MatuskaExamples of supported options: 591caf54c4fSMartin Matuska.Bl -tag -compact -width indent 592caf54c4fSMartin Matuska.It Cm iso9660:joliet 593caf54c4fSMartin MatuskaSupport Joliet extensions. 594caf54c4fSMartin MatuskaThis is enabled by default, use 595caf54c4fSMartin Matuska.Cm !joliet 596caf54c4fSMartin Matuskaor 597caf54c4fSMartin Matuska.Cm iso9660:!joliet 598caf54c4fSMartin Matuskato disable. 599caf54c4fSMartin Matuska.It Cm iso9660:rockridge 600caf54c4fSMartin MatuskaSupport Rock Ridge extensions. 601caf54c4fSMartin MatuskaThis is enabled by default, use 602caf54c4fSMartin Matuska.Cm !rockridge 603caf54c4fSMartin Matuskaor 604caf54c4fSMartin Matuska.Cm iso9660:!rockridge 605caf54c4fSMartin Matuskato disable. 606caf54c4fSMartin Matuska.It Cm gzip:compression-level 607acc60b03SMartin MatuskaA decimal integer from 1 to 9 specifying the gzip compression level. 608acc60b03SMartin Matuska.It Cm gzip:timestamp 609f057565eSMartin MatuskaStore timestamp. 610f057565eSMartin MatuskaThis is enabled by default, use 611acc60b03SMartin Matuska.Cm !timestamp 612acc60b03SMartin Matuskaor 613acc60b03SMartin Matuska.Cm gzip:!timestamp 614acc60b03SMartin Matuskato disable. 615acc60b03SMartin Matuska.It Cm lrzip:compression Ns = Ns Ar type 616acc60b03SMartin MatuskaUse 617acc60b03SMartin Matuska.Ar type 618acc60b03SMartin Matuskaas compression method. 619acc60b03SMartin MatuskaSupported values are bzip2, gzip, lzo (ultra fast), 620acc60b03SMartin Matuskaand zpaq (best, extremely slow). 621acc60b03SMartin Matuska.It Cm lrzip:compression-level 622acc60b03SMartin MatuskaA decimal integer from 1 to 9 specifying the lrzip compression level. 623cdf63a70SMartin Matuska.It Cm lz4:compression-level 624cdf63a70SMartin MatuskaA decimal integer from 1 to 9 specifying the lzop compression level. 625cdf63a70SMartin Matuska.It Cm lz4:stream-checksum 626f057565eSMartin MatuskaEnable stream checksum. 627f057565eSMartin MatuskaThis is by default, use 628cdf63a70SMartin Matuska.Cm lz4:!stream-checksum 629cdf63a70SMartin Matuskato disable. 630cdf63a70SMartin Matuska.It Cm lz4:block-checksum 631cdf63a70SMartin MatuskaEnable block checksum (Disabled by default). 632cdf63a70SMartin Matuska.It Cm lz4:block-size 633cdf63a70SMartin MatuskaA decimal integer from 4 to 7 specifying the lz4 compression block size 634cdf63a70SMartin Matuska(7 is set by default). 635cdf63a70SMartin Matuska.It Cm lz4:block-dependence 636cdf63a70SMartin MatuskaUse the previous block of the block being compressed for 637cdf63a70SMartin Matuskaa compression dictionary to improve compression ratio. 6385c831a5bSMartin Matuska.It Cm zstd:compression-level 639de6fa6b4SMartin MatuskaA decimal integer specifying the zstd compression level. Supported values depend 640de6fa6b4SMartin Matuskaon the library version, common values are from 1 to 22. 641833a452eSMartin Matuska.It Cm zstd:threads 642833a452eSMartin MatuskaSpecify the number of worker threads to use. 643833a452eSMartin MatuskaSetting threads to a special value 0 makes 644833a452eSMartin Matuska.Xr zstd 1 645833a452eSMartin Matuskause as many threads as there are CPU cores on the system. 646acc60b03SMartin Matuska.It Cm lzop:compression-level 647acc60b03SMartin MatuskaA decimal integer from 1 to 9 specifying the lzop compression level. 648caf54c4fSMartin Matuska.It Cm xz:compression-level 649caf54c4fSMartin MatuskaA decimal integer from 0 to 9 specifying the xz compression level. 650833a452eSMartin Matuska.It Cm xz:threads 651833a452eSMartin MatuskaSpecify the number of worker threads to use. 652833a452eSMartin MatuskaSetting threads to a special value 0 makes 653833a452eSMartin Matuska.Xr xz 1 654833a452eSMartin Matuskause as many threads as there are CPU cores on the system. 655caf54c4fSMartin Matuska.It Cm mtree: Ns Ar keyword 656caf54c4fSMartin MatuskaThe mtree writer module allows you to specify which mtree keywords 657caf54c4fSMartin Matuskawill be included in the output. 658caf54c4fSMartin MatuskaSupported keywords include: 659caf54c4fSMartin Matuska.Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent , 660caf54c4fSMartin Matuska.Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 , 661caf54c4fSMartin Matuska.Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname . 662caf54c4fSMartin MatuskaThe default is equivalent to: 663caf54c4fSMartin Matuska.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname . 664caf54c4fSMartin Matuska.It Cm mtree:all 665caf54c4fSMartin MatuskaEnables all of the above keywords. 666caf54c4fSMartin MatuskaYou can also use 667caf54c4fSMartin Matuska.Cm mtree:!all 668caf54c4fSMartin Matuskato disable all keywords. 669caf54c4fSMartin Matuska.It Cm mtree:use-set 670caf54c4fSMartin MatuskaEnable generation of 671caf54c4fSMartin Matuska.Cm /set 672caf54c4fSMartin Matuskalines in the output. 673caf54c4fSMartin Matuska.It Cm mtree:indent 674caf54c4fSMartin MatuskaProduce human-readable output by indenting options and splitting lines 675caf54c4fSMartin Matuskato fit into 80 columns. 676caf54c4fSMartin Matuska.It Cm zip:compression Ns = Ns Ar type 677caf54c4fSMartin MatuskaUse 678caf54c4fSMartin Matuska.Ar type 679caf54c4fSMartin Matuskaas compression method. 680caf54c4fSMartin MatuskaSupported values are store (uncompressed) and deflate (gzip algorithm). 681cdf63a70SMartin Matuska.It Cm zip:encryption 682cdf63a70SMartin MatuskaEnable encryption using traditional zip encryption. 683cdf63a70SMartin Matuska.It Cm zip:encryption Ns = Ns Ar type 684cdf63a70SMartin MatuskaUse 685cdf63a70SMartin Matuska.Ar type 686cdf63a70SMartin Matuskaas encryption type. 687cdf63a70SMartin MatuskaSupported values are zipcrypt (traditional zip encryption), 688cdf63a70SMartin Matuskaaes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryption). 689cdf63a70SMartin Matuska.It Cm read_concatenated_archives 690cdf63a70SMartin MatuskaIgnore zeroed blocks in the archive, which occurs when multiple tar archives 691f057565eSMartin Matuskahave been concatenated together. 692f057565eSMartin MatuskaWithout this option, only the contents of 693f057565eSMartin Matuskathe first concatenated archive would be read. 694f057565eSMartin MatuskaThis option is comparable to the 695cdf63a70SMartin Matuska.Fl i , Fl Fl ignore-zeros 696cdf63a70SMartin Matuskaoption of GNU tar. 697caf54c4fSMartin Matuska.El 698caf54c4fSMartin MatuskaIf a provided option is not supported by any module, that 699caf54c4fSMartin Matuskais a fatal error. 700c5d360f8SMartin Matuska.It Fl P , Fl Fl absolute-paths 701caf54c4fSMartin MatuskaPreserve pathnames. 702caf54c4fSMartin MatuskaBy default, absolute pathnames (those that begin with a / 703caf54c4fSMartin Matuskacharacter) have the leading slash removed both when creating archives 704caf54c4fSMartin Matuskaand extracting from them. 705caf54c4fSMartin MatuskaAlso, 706caf54c4fSMartin Matuska.Nm 707caf54c4fSMartin Matuskawill refuse to extract archive entries whose pathnames contain 708caf54c4fSMartin Matuska.Pa .. 709caf54c4fSMartin Matuskaor whose target directory would be altered by a symlink. 710caf54c4fSMartin MatuskaThis option suppresses these behaviors. 711c5d360f8SMartin Matuska.It Fl p , Fl Fl insecure , Fl Fl preserve-permissions 712caf54c4fSMartin Matuska(x mode only) 713caf54c4fSMartin MatuskaPreserve file permissions. 714fae5c36eSMartin MatuskaAttempt to restore the full permissions, including file modes, file attributes 715fae5c36eSMartin Matuskaor file flags, extended file attributes and ACLs, if available, for each item 716f057565eSMartin Matuskaextracted from the archive. 717f057565eSMartin MatuskaThis is the reverse of 71864287048SMartin Matuska.Fl Fl no-same-permissions 71964287048SMartin Matuskaand the default if 720caf54c4fSMartin Matuska.Nm 721f057565eSMartin Matuskais being run as root. 722f057565eSMartin MatuskaIt can be partially overridden by also specifying 72364287048SMartin Matuska.Fl Fl no-acls , 72464287048SMartin Matuska.Fl Fl no-fflags , 72564287048SMartin Matuska.Fl Fl no-mac-metadata 72664287048SMartin Matuskaor 72764287048SMartin Matuska.Fl Fl no-xattrs . 728cdf63a70SMartin Matuska.It Fl Fl passphrase Ar passphrase 729cdf63a70SMartin MatuskaThe 730cdf63a70SMartin Matuska.Pa passphrase 731cdf63a70SMartin Matuskais used to extract or create an encrypted archive. 732cdf63a70SMartin MatuskaCurrently, zip is the only supported format that supports encryption. 733cdf63a70SMartin MatuskaYou shouldn't use this option unless you realize how insecure 734cdf63a70SMartin Matuskause of this option is. 735c5d360f8SMartin Matuska.It Fl Fl posix 736c5d360f8SMartin Matuska(c, r, u mode only) 737c5d360f8SMartin MatuskaSynonym for 738c5d360f8SMartin Matuska.Fl Fl format Ar pax 739c5d360f8SMartin Matuska.It Fl q , Fl Fl fast-read 740caf54c4fSMartin Matuska(x and t mode only) 741caf54c4fSMartin MatuskaExtract or list only the first archive entry that matches each pattern 742caf54c4fSMartin Matuskaor filename operand. 743caf54c4fSMartin MatuskaExit as soon as each specified pattern or filename has been matched. 744caf54c4fSMartin MatuskaBy default, the archive is always read to the very end, since 745caf54c4fSMartin Matuskathere can be multiple entries with the same name and, by convention, 746caf54c4fSMartin Matuskalater entries overwrite earlier entries. 747caf54c4fSMartin MatuskaThis option is provided as a performance optimization. 748833a452eSMartin Matuska.It Fl Fl read-sparse 749833a452eSMartin Matuska(c, r, u modes only) 750833a452eSMartin MatuskaRead sparse file information from disk. 751833a452eSMartin MatuskaThis is the reverse of 752833a452eSMartin Matuska.Fl Fl no-read-sparse 753833a452eSMartin Matuskaand the default behavior. 754caf54c4fSMartin Matuska.It Fl S 755caf54c4fSMartin Matuska(x mode only) 756caf54c4fSMartin MatuskaExtract files as sparse files. 757caf54c4fSMartin MatuskaFor every block on disk, check first if it contains only NULL bytes and seek 758caf54c4fSMartin Matuskaover it otherwise. 759c5d360f8SMartin MatuskaThis works similar to the conv=sparse option of dd. 760caf54c4fSMartin Matuska.It Fl s Ar pattern 761caf54c4fSMartin MatuskaModify file or archive member names according to 762caf54c4fSMartin Matuska.Pa pattern . 763caf54c4fSMartin MatuskaThe pattern has the format 7646c95142eSMartin Matuska.Ar /old/new/ Ns Op ghHprRsS 765caf54c4fSMartin Matuskawhere 766caf54c4fSMartin Matuska.Ar old 767caf54c4fSMartin Matuskais a basic regular expression, 768caf54c4fSMartin Matuska.Ar new 769caf54c4fSMartin Matuskais the replacement string of the matched part, 770caf54c4fSMartin Matuskaand the optional trailing letters modify 771caf54c4fSMartin Matuskahow the replacement is handled. 772caf54c4fSMartin MatuskaIf 773caf54c4fSMartin Matuska.Ar old 774caf54c4fSMartin Matuskais not matched, the pattern is skipped. 775caf54c4fSMartin MatuskaWithin 776caf54c4fSMartin Matuska.Ar new , 777caf54c4fSMartin Matuska~ is substituted with the match, \e1 to \e9 with the content of 778caf54c4fSMartin Matuskathe corresponding captured group. 779caf54c4fSMartin MatuskaThe optional trailing g specifies that matching should continue 7806c95142eSMartin Matuskaafter the matched part and stop on the first unmatched pattern. 781caf54c4fSMartin MatuskaThe optional trailing s specifies that the pattern applies to the value 782caf54c4fSMartin Matuskaof symbolic links. 783caf54c4fSMartin MatuskaThe optional trailing p specifies that after a successful substitution 784caf54c4fSMartin Matuskathe original path name and the new path name should be printed to 785caf54c4fSMartin Matuskastandard error. 7866c95142eSMartin MatuskaOptional trailing H, R, or S characters suppress substitutions 7876c95142eSMartin Matuskafor hardlink targets, regular filenames, or symlink targets, 7886c95142eSMartin Matuskarespectively. 7896c95142eSMartin MatuskaOptional trailing h, r, or s characters enable substitutions 7906c95142eSMartin Matuskafor hardlink targets, regular filenames, or symlink targets, 7916c95142eSMartin Matuskarespectively. 7926c95142eSMartin MatuskaThe default is 7936c95142eSMartin Matuska.Ar hrs 7946c95142eSMartin Matuskawhich applies substitutions to all names. 7956c95142eSMartin MatuskaIn particular, it is never necessary to specify h, r, or s. 796f9762417SMartin Matuska.It Fl Fl safe-writes 797f9762417SMartin Matuska(x mode only) 798f9762417SMartin MatuskaExtract files atomically. 799f9762417SMartin MatuskaBy default 800f9762417SMartin Matuska.Nm 801f9762417SMartin Matuskaunlinks the original file with the same name as the extracted file (if it 802f9762417SMartin Matuskaexists), and then creates it immediately under the same name and writes to 803f9762417SMartin Matuskait. 804f9762417SMartin MatuskaFor a short period of time, applications trying to access the file might 805f9762417SMartin Matuskanot find it, or see incomplete results. 806f9762417SMartin MatuskaIf 807f9762417SMartin Matuska.Fl Fl safe-writes 808f9762417SMartin Matuskais enabled, 809f9762417SMartin Matuska.Nm 810f9762417SMartin Matuskafirst creates a unique temporary file, then writes the new contents to 811f9762417SMartin Matuskathe temporary file, and finally renames the temporary file to its final 812f9762417SMartin Matuskaname atomically using 813f9762417SMartin Matuska.Xr rename 2 . 814f9762417SMartin MatuskaThis guarantees that an application accessing the file, will either see 815f9762417SMartin Matuskathe old contents or the new contents at all times. 8166c95142eSMartin Matuska.It Fl Fl same-owner 8176c95142eSMartin Matuska(x mode only) 8186c95142eSMartin MatuskaExtract owner and group IDs. 8196c95142eSMartin MatuskaThis is the reverse of 8206c95142eSMartin Matuska.Fl Fl no-same-owner 8216c95142eSMartin Matuskaand the default behavior if 8226c95142eSMartin Matuska.Nm 8236c95142eSMartin Matuskais run as root. 8246c95142eSMartin Matuska.It Fl Fl strip-components Ar count 8256c95142eSMartin MatuskaRemove the specified number of leading path elements. 8266c95142eSMartin MatuskaPathnames with fewer elements will be silently skipped. 8276c95142eSMartin MatuskaNote that the pathname is edited after checking inclusion/exclusion patterns 8286c95142eSMartin Matuskabut before security checks. 829c5d360f8SMartin Matuska.It Fl T Ar filename , Fl Fl files-from Ar filename 830caf54c4fSMartin MatuskaIn x or t mode, 831caf54c4fSMartin Matuska.Nm 832caf54c4fSMartin Matuskawill read the list of names to be extracted from 833caf54c4fSMartin Matuska.Pa filename . 834caf54c4fSMartin MatuskaIn c mode, 835caf54c4fSMartin Matuska.Nm 836caf54c4fSMartin Matuskawill read names to be archived from 837caf54c4fSMartin Matuska.Pa filename . 838caf54c4fSMartin MatuskaThe special name 839caf54c4fSMartin Matuska.Dq -C 840caf54c4fSMartin Matuskaon a line by itself will cause the current directory to be changed to 841caf54c4fSMartin Matuskathe directory specified on the following line. 842caf54c4fSMartin MatuskaNames are terminated by newlines unless 843c5d360f8SMartin Matuska.Fl Fl null 844caf54c4fSMartin Matuskais specified. 845caf54c4fSMartin MatuskaNote that 846c5d360f8SMartin Matuska.Fl Fl null 847caf54c4fSMartin Matuskaalso disables the special handling of lines containing 848caf54c4fSMartin Matuska.Dq -C . 849acc60b03SMartin MatuskaNote: If you are generating lists of files using 850acc60b03SMartin Matuska.Xr find 1 , 851acc60b03SMartin Matuskayou probably want to use 852acc60b03SMartin Matuska.Fl n 853acc60b03SMartin Matuskaas well. 854c5d360f8SMartin Matuska.It Fl Fl totals 85564287048SMartin Matuska(c, r, u modes only) 856c5d360f8SMartin MatuskaAfter archiving all files, print a summary to stderr. 857c5d360f8SMartin Matuska.It Fl U , Fl Fl unlink , Fl Fl unlink-first 858caf54c4fSMartin Matuska(x mode only) 859caf54c4fSMartin MatuskaUnlink files before creating them. 860c5d360f8SMartin MatuskaThis can be a minor performance optimization if most files 861c5d360f8SMartin Matuskaalready exist, but can make things slower if most files 862c5d360f8SMartin Matuskado not already exist. 863c5d360f8SMartin MatuskaThis flag also causes 864caf54c4fSMartin Matuska.Nm 865c5d360f8SMartin Matuskato remove intervening directory symlinks instead of 866c5d360f8SMartin Matuskareporting an error. 867c5d360f8SMartin MatuskaSee the SECURITY section below for more details. 868caf54c4fSMartin Matuska.It Fl Fl uid Ar id 869caf54c4fSMartin MatuskaUse the provided user id number and ignore the user 870caf54c4fSMartin Matuskaname from the archive. 871caf54c4fSMartin MatuskaOn create, if 872caf54c4fSMartin Matuska.Fl Fl uname 873caf54c4fSMartin Matuskais not also specified, the user name will be set to 874caf54c4fSMartin Matuskamatch the user id. 875caf54c4fSMartin Matuska.It Fl Fl uname Ar name 876caf54c4fSMartin MatuskaUse the provided user name. 877caf54c4fSMartin MatuskaOn extract, this overrides the user name in the archive; 878caf54c4fSMartin Matuskaif the provided user name does not exist on the system, 879caf54c4fSMartin Matuskait will be ignored and the user id 880caf54c4fSMartin Matuska(from the archive or from the 881caf54c4fSMartin Matuska.Fl Fl uid 882caf54c4fSMartin Matuskaoption) 883caf54c4fSMartin Matuskawill be used instead. 884caf54c4fSMartin MatuskaOn create, this sets the user name that will be stored 885caf54c4fSMartin Matuskain the archive; 886caf54c4fSMartin Matuskathe name is not verified against the system user database. 887caf54c4fSMartin Matuska.It Fl Fl use-compress-program Ar program 888caf54c4fSMartin MatuskaPipe the input (in x or t mode) or the output (in c mode) through 889caf54c4fSMartin Matuska.Pa program 890caf54c4fSMartin Matuskainstead of using the builtin compression support. 891c5d360f8SMartin Matuska.It Fl v , Fl Fl verbose 892caf54c4fSMartin MatuskaProduce verbose output. 893caf54c4fSMartin MatuskaIn create and extract modes, 894caf54c4fSMartin Matuska.Nm 895caf54c4fSMartin Matuskawill list each file name as it is read from or written to 896caf54c4fSMartin Matuskathe archive. 897caf54c4fSMartin MatuskaIn list mode, 898caf54c4fSMartin Matuska.Nm 899caf54c4fSMartin Matuskawill produce output similar to that of 900caf54c4fSMartin Matuska.Xr ls 1 . 901cdf63a70SMartin MatuskaAn additional 902caf54c4fSMartin Matuska.Fl v 903cdf63a70SMartin Matuskaoption will also provide ls-like details in create and extract mode. 904c5d360f8SMartin Matuska.It Fl Fl version 905caf54c4fSMartin MatuskaPrint version of 906caf54c4fSMartin Matuska.Nm 907caf54c4fSMartin Matuskaand 908caf54c4fSMartin Matuska.Nm libarchive , 909caf54c4fSMartin Matuskaand exit. 910c5d360f8SMartin Matuska.It Fl w , Fl Fl confirmation , Fl Fl interactive 911caf54c4fSMartin MatuskaAsk for confirmation for every action. 912c5d360f8SMartin Matuska.It Fl X Ar filename , Fl Fl exclude-from Ar filename 913caf54c4fSMartin MatuskaRead a list of exclusion patterns from the specified file. 914caf54c4fSMartin MatuskaSee 915c5d360f8SMartin Matuska.Fl Fl exclude 916caf54c4fSMartin Matuskafor more information about the handling of exclusions. 91764287048SMartin Matuska.It Fl Fl xattrs 91864287048SMartin Matuska(c, r, u, x modes only) 919f057565eSMartin MatuskaArchive or extract extended file attributes. 920f057565eSMartin MatuskaThis is the reverse of 92164287048SMartin Matuska.Fl Fl no-xattrs 92264287048SMartin Matuskaand the default behavior in c, r, and u modes or if 92364287048SMartin Matuska.Nm 92464287048SMartin Matuskais run in x mode as root. 925caf54c4fSMartin Matuska.It Fl y 926caf54c4fSMartin Matuska(c mode only) 927caf54c4fSMartin MatuskaCompress the resulting archive with 928caf54c4fSMartin Matuska.Xr bzip2 1 . 929caf54c4fSMartin MatuskaIn extract or list modes, this option is ignored. 9305c831a5bSMartin MatuskaNote that this 931caf54c4fSMartin Matuska.Nm tar 9325c831a5bSMartin Matuskaimplementation recognizes bzip2 compression automatically when reading 9335c831a5bSMartin Matuskaarchives. 934c5d360f8SMartin Matuska.It Fl Z , Fl Fl compress , Fl Fl uncompress 935caf54c4fSMartin Matuska(c mode only) 936caf54c4fSMartin MatuskaCompress the resulting archive with 937caf54c4fSMartin Matuska.Xr compress 1 . 938caf54c4fSMartin MatuskaIn extract or list modes, this option is ignored. 9395c831a5bSMartin MatuskaNote that this 940caf54c4fSMartin Matuska.Nm tar 9415c831a5bSMartin Matuskaimplementation recognizes compress compression automatically when reading 9425c831a5bSMartin Matuskaarchives. 943c5d360f8SMartin Matuska.It Fl z , Fl Fl gunzip , Fl Fl gzip 944c5d360f8SMartin Matuska(c mode only) 945c5d360f8SMartin MatuskaCompress the resulting archive with 946c5d360f8SMartin Matuska.Xr gzip 1 . 947c5d360f8SMartin MatuskaIn extract or list modes, this option is ignored. 9485c831a5bSMartin MatuskaNote that this 949c5d360f8SMartin Matuska.Nm tar 9505c831a5bSMartin Matuskaimplementation recognizes gzip compression automatically when reading 9515c831a5bSMartin Matuskaarchives. 952caf54c4fSMartin Matuska.El 953caf54c4fSMartin Matuska.Sh ENVIRONMENT 954caf54c4fSMartin MatuskaThe following environment variables affect the execution of 955caf54c4fSMartin Matuska.Nm : 956*bd5e624aSMartin Matuska.Bl -tag -width indent 957acc60b03SMartin Matuska.It Ev TAR_READER_OPTIONS 958acc60b03SMartin MatuskaThe default options for format readers and compression readers. 959acc60b03SMartin MatuskaThe 960acc60b03SMartin Matuska.Fl Fl options 961acc60b03SMartin Matuskaoption overrides this. 962acc60b03SMartin Matuska.It Ev TAR_WRITER_OPTIONS 963acc60b03SMartin MatuskaThe default options for format writers and compression writers. 964acc60b03SMartin MatuskaThe 965acc60b03SMartin Matuska.Fl Fl options 966acc60b03SMartin Matuskaoption overrides this. 967caf54c4fSMartin Matuska.It Ev LANG 968caf54c4fSMartin MatuskaThe locale to use. 969caf54c4fSMartin MatuskaSee 970caf54c4fSMartin Matuska.Xr environ 7 971caf54c4fSMartin Matuskafor more information. 972caf54c4fSMartin Matuska.It Ev TAPE 973c5d360f8SMartin MatuskaThe default device. 974caf54c4fSMartin MatuskaThe 975caf54c4fSMartin Matuska.Fl f 976caf54c4fSMartin Matuskaoption overrides this. 977c5d360f8SMartin MatuskaPlease see the description of the 978c5d360f8SMartin Matuska.Fl f 979c5d360f8SMartin Matuskaoption above for more details. 980caf54c4fSMartin Matuska.It Ev TZ 981caf54c4fSMartin MatuskaThe timezone to use when displaying dates. 982caf54c4fSMartin MatuskaSee 983caf54c4fSMartin Matuska.Xr environ 7 984caf54c4fSMartin Matuskafor more information. 985caf54c4fSMartin Matuska.El 986c5d360f8SMartin Matuska.Sh EXIT STATUS 987c5d360f8SMartin Matuska.Ex -std 988caf54c4fSMartin Matuska.Sh EXAMPLES 989caf54c4fSMartin MatuskaThe following creates a new archive 990caf54c4fSMartin Matuskacalled 991caf54c4fSMartin Matuska.Ar file.tar.gz 992caf54c4fSMartin Matuskathat contains two files 993caf54c4fSMartin Matuska.Ar source.c 994caf54c4fSMartin Matuskaand 995caf54c4fSMartin Matuska.Ar source.h : 996caf54c4fSMartin Matuska.Dl Nm Fl czf Pa file.tar.gz Pa source.c Pa source.h 997caf54c4fSMartin Matuska.Pp 998caf54c4fSMartin MatuskaTo view a detailed table of contents for this 999caf54c4fSMartin Matuskaarchive: 1000caf54c4fSMartin Matuska.Dl Nm Fl tvf Pa file.tar.gz 1001caf54c4fSMartin Matuska.Pp 1002caf54c4fSMartin MatuskaTo extract all entries from the archive on 1003caf54c4fSMartin Matuskathe default tape drive: 1004caf54c4fSMartin Matuska.Dl Nm Fl x 1005caf54c4fSMartin Matuska.Pp 1006caf54c4fSMartin MatuskaTo examine the contents of an ISO 9660 cdrom image: 1007caf54c4fSMartin Matuska.Dl Nm Fl tf Pa image.iso 1008caf54c4fSMartin Matuska.Pp 1009caf54c4fSMartin MatuskaTo move file hierarchies, invoke 1010caf54c4fSMartin Matuska.Nm 1011caf54c4fSMartin Matuskaas 1012f057565eSMartin Matuska.Dl Nm Fl cf Pa - Fl C Pa srcdir \&. | Nm Fl xpf Pa - Fl C Pa destdir 1013caf54c4fSMartin Matuskaor more traditionally 1014f057565eSMartin Matuska.Dl cd srcdir \&; Nm Fl cf Pa - \&. | ( cd destdir \&; Nm Fl xpf Pa - ) 1015caf54c4fSMartin Matuska.Pp 1016caf54c4fSMartin MatuskaIn create mode, the list of files and directories to be archived 1017caf54c4fSMartin Matuskacan also include directory change instructions of the form 1018caf54c4fSMartin Matuska.Cm -C Ns Pa foo/baz 1019caf54c4fSMartin Matuskaand archive inclusions of the form 1020caf54c4fSMartin Matuska.Cm @ Ns Pa archive-file . 1021caf54c4fSMartin MatuskaFor example, the command line 1022caf54c4fSMartin Matuska.Dl Nm Fl c Fl f Pa new.tar Pa foo1 Cm @ Ns Pa old.tgz Cm -C Ns Pa /tmp Pa foo2 1023caf54c4fSMartin Matuskawill create a new archive 1024caf54c4fSMartin Matuska.Pa new.tar . 1025caf54c4fSMartin Matuska.Nm 1026caf54c4fSMartin Matuskawill read the file 1027caf54c4fSMartin Matuska.Pa foo1 1028caf54c4fSMartin Matuskafrom the current directory and add it to the output archive. 1029caf54c4fSMartin MatuskaIt will then read each entry from 1030caf54c4fSMartin Matuska.Pa old.tgz 1031caf54c4fSMartin Matuskaand add those entries to the output archive. 1032caf54c4fSMartin MatuskaFinally, it will switch to the 1033caf54c4fSMartin Matuska.Pa /tmp 1034caf54c4fSMartin Matuskadirectory and add 1035caf54c4fSMartin Matuska.Pa foo2 1036caf54c4fSMartin Matuskato the output archive. 1037caf54c4fSMartin Matuska.Pp 1038caf54c4fSMartin MatuskaAn input file in 1039caf54c4fSMartin Matuska.Xr mtree 5 1040caf54c4fSMartin Matuskaformat can be used to create an output archive with arbitrary ownership, 1041caf54c4fSMartin Matuskapermissions, or names that differ from existing data on disk: 1042cdf63a70SMartin Matuska.Bd -literal -offset indent 1043cdf63a70SMartin Matuska$ cat input.mtree 1044cdf63a70SMartin Matuska#mtree 1045cdf63a70SMartin Matuskausr/bin uid=0 gid=0 mode=0755 type=dir 1046cdf63a70SMartin Matuskausr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls 1047cdf63a70SMartin Matuska$ tar -cvf output.tar @input.mtree 1048cdf63a70SMartin Matuska.Ed 1049caf54c4fSMartin Matuska.Pp 1050caf54c4fSMartin MatuskaThe 1051c5d360f8SMartin Matuska.Fl Fl newer 1052caf54c4fSMartin Matuskaand 1053c5d360f8SMartin Matuska.Fl Fl newer-mtime 1054caf54c4fSMartin Matuskaswitches accept a variety of common date and time specifications, including 1055caf54c4fSMartin Matuska.Dq 12 Mar 2005 7:14:29pm , 1056caf54c4fSMartin Matuska.Dq 2005-03-12 19:14 , 1057caf54c4fSMartin Matuska.Dq 5 minutes ago , 1058caf54c4fSMartin Matuskaand 1059caf54c4fSMartin Matuska.Dq 19:14 PST May 1 . 1060caf54c4fSMartin Matuska.Pp 1061caf54c4fSMartin MatuskaThe 1062c5d360f8SMartin Matuska.Fl Fl options 1063caf54c4fSMartin Matuskaargument can be used to control various details of archive generation 1064caf54c4fSMartin Matuskaor reading. 1065caf54c4fSMartin MatuskaFor example, you can generate mtree output which only contains 1066caf54c4fSMartin Matuska.Cm type , Cm time , 1067caf54c4fSMartin Matuskaand 1068caf54c4fSMartin Matuska.Cm uid 1069caf54c4fSMartin Matuskakeywords: 1070c5d360f8SMartin Matuska.Dl Nm Fl cf Pa file.tar Fl Fl format=mtree Fl Fl options='!all,type,time,uid' Pa dir 1071caf54c4fSMartin Matuskaor you can set the compression level used by gzip or xz compression: 1072c5d360f8SMartin Matuska.Dl Nm Fl czf Pa file.tar Fl Fl options='compression-level=9' . 1073caf54c4fSMartin MatuskaFor more details, see the explanation of the 1074caf54c4fSMartin Matuska.Fn archive_read_set_options 1075caf54c4fSMartin Matuskaand 1076caf54c4fSMartin Matuska.Fn archive_write_set_options 1077caf54c4fSMartin MatuskaAPI calls that are described in 1078caf54c4fSMartin Matuska.Xr archive_read 3 1079caf54c4fSMartin Matuskaand 1080caf54c4fSMartin Matuska.Xr archive_write 3 . 1081caf54c4fSMartin Matuska.Sh COMPATIBILITY 1082caf54c4fSMartin MatuskaThe bundled-arguments format is supported for compatibility 1083caf54c4fSMartin Matuskawith historic implementations. 1084caf54c4fSMartin MatuskaIt consists of an initial word (with no leading - character) in which 1085caf54c4fSMartin Matuskaeach character indicates an option. 1086caf54c4fSMartin MatuskaArguments follow as separate words. 1087caf54c4fSMartin MatuskaThe order of the arguments must match the order 1088caf54c4fSMartin Matuskaof the corresponding characters in the bundled command word. 1089caf54c4fSMartin MatuskaFor example, 1090caf54c4fSMartin Matuska.Dl Nm Cm tbf 32 Pa file.tar 1091caf54c4fSMartin Matuskaspecifies three flags 1092caf54c4fSMartin Matuska.Cm t , 1093caf54c4fSMartin Matuska.Cm b , 1094caf54c4fSMartin Matuskaand 1095caf54c4fSMartin Matuska.Cm f . 1096caf54c4fSMartin MatuskaThe 1097caf54c4fSMartin Matuska.Cm b 1098caf54c4fSMartin Matuskaand 1099caf54c4fSMartin Matuska.Cm f 1100caf54c4fSMartin Matuskaflags both require arguments, 1101caf54c4fSMartin Matuskaso there must be two additional items 1102caf54c4fSMartin Matuskaon the command line. 1103caf54c4fSMartin MatuskaThe 1104caf54c4fSMartin Matuska.Ar 32 1105caf54c4fSMartin Matuskais the argument to the 1106caf54c4fSMartin Matuska.Cm b 1107caf54c4fSMartin Matuskaflag, and 1108caf54c4fSMartin Matuska.Ar file.tar 1109caf54c4fSMartin Matuskais the argument to the 1110caf54c4fSMartin Matuska.Cm f 1111caf54c4fSMartin Matuskaflag. 1112caf54c4fSMartin Matuska.Pp 1113caf54c4fSMartin MatuskaThe mode options c, r, t, u, and x and the options 1114caf54c4fSMartin Matuskab, f, l, m, o, v, and w comply with SUSv2. 1115caf54c4fSMartin Matuska.Pp 1116caf54c4fSMartin MatuskaFor maximum portability, scripts that invoke 1117caf54c4fSMartin Matuska.Nm tar 1118caf54c4fSMartin Matuskashould use the bundled-argument format above, should limit 1119caf54c4fSMartin Matuskathemselves to the 1120caf54c4fSMartin Matuska.Cm c , 1121caf54c4fSMartin Matuska.Cm t , 1122caf54c4fSMartin Matuskaand 1123caf54c4fSMartin Matuska.Cm x 1124caf54c4fSMartin Matuskamodes, and the 1125caf54c4fSMartin Matuska.Cm b , 1126caf54c4fSMartin Matuska.Cm f , 1127caf54c4fSMartin Matuska.Cm m , 1128caf54c4fSMartin Matuska.Cm v , 1129caf54c4fSMartin Matuskaand 1130caf54c4fSMartin Matuska.Cm w 1131caf54c4fSMartin Matuskaoptions. 1132caf54c4fSMartin Matuska.Pp 1133caf54c4fSMartin MatuskaAdditional long options are provided to improve compatibility with other 1134caf54c4fSMartin Matuskatar implementations. 1135caf54c4fSMartin Matuska.Sh SECURITY 1136caf54c4fSMartin MatuskaCertain security issues are common to many archiving programs, including 1137caf54c4fSMartin Matuska.Nm . 1138caf54c4fSMartin MatuskaIn particular, carefully-crafted archives can request that 1139caf54c4fSMartin Matuska.Nm 1140caf54c4fSMartin Matuskaextract files to locations outside of the target directory. 1141caf54c4fSMartin MatuskaThis can potentially be used to cause unwitting users to overwrite 1142caf54c4fSMartin Matuskafiles they did not intend to overwrite. 1143caf54c4fSMartin MatuskaIf the archive is being extracted by the superuser, any file 1144caf54c4fSMartin Matuskaon the system can potentially be overwritten. 1145caf54c4fSMartin MatuskaThere are three ways this can happen. 1146caf54c4fSMartin MatuskaAlthough 1147caf54c4fSMartin Matuska.Nm 1148caf54c4fSMartin Matuskahas mechanisms to protect against each one, 1149caf54c4fSMartin Matuskasavvy users should be aware of the implications: 1150caf54c4fSMartin Matuska.Bl -bullet -width indent 1151caf54c4fSMartin Matuska.It 1152caf54c4fSMartin MatuskaArchive entries can have absolute pathnames. 1153caf54c4fSMartin MatuskaBy default, 1154caf54c4fSMartin Matuska.Nm 1155caf54c4fSMartin Matuskaremoves the leading 1156caf54c4fSMartin Matuska.Pa / 1157caf54c4fSMartin Matuskacharacter from filenames before restoring them to guard against this problem. 1158caf54c4fSMartin Matuska.It 1159caf54c4fSMartin MatuskaArchive entries can have pathnames that include 1160caf54c4fSMartin Matuska.Pa .. 1161caf54c4fSMartin Matuskacomponents. 1162caf54c4fSMartin MatuskaBy default, 1163caf54c4fSMartin Matuska.Nm 1164caf54c4fSMartin Matuskawill not extract files containing 1165caf54c4fSMartin Matuska.Pa .. 1166caf54c4fSMartin Matuskacomponents in their pathname. 1167caf54c4fSMartin Matuska.It 1168caf54c4fSMartin MatuskaArchive entries can exploit symbolic links to restore 1169caf54c4fSMartin Matuskafiles to other directories. 1170caf54c4fSMartin MatuskaAn archive can restore a symbolic link to another directory, 1171caf54c4fSMartin Matuskathen use that link to restore a file into that directory. 1172caf54c4fSMartin MatuskaTo guard against this, 1173caf54c4fSMartin Matuska.Nm 1174caf54c4fSMartin Matuskachecks each extracted path for symlinks. 1175caf54c4fSMartin MatuskaIf the final path element is a symlink, it will be removed 1176caf54c4fSMartin Matuskaand replaced with the archive entry. 1177caf54c4fSMartin MatuskaIf 1178caf54c4fSMartin Matuska.Fl U 1179caf54c4fSMartin Matuskais specified, any intermediate symlink will also be unconditionally removed. 1180caf54c4fSMartin MatuskaIf neither 1181caf54c4fSMartin Matuska.Fl U 1182caf54c4fSMartin Matuskanor 1183caf54c4fSMartin Matuska.Fl P 1184caf54c4fSMartin Matuskais specified, 1185caf54c4fSMartin Matuska.Nm 1186caf54c4fSMartin Matuskawill refuse to extract the entry. 1187caf54c4fSMartin Matuska.El 1188caf54c4fSMartin MatuskaTo protect yourself, you should be wary of any archives that 1189caf54c4fSMartin Matuskacome from untrusted sources. 1190caf54c4fSMartin MatuskaYou should examine the contents of an archive with 1191caf54c4fSMartin Matuska.Dl Nm Fl tf Pa filename 1192caf54c4fSMartin Matuskabefore extraction. 1193caf54c4fSMartin MatuskaYou should use the 1194caf54c4fSMartin Matuska.Fl k 1195caf54c4fSMartin Matuskaoption to ensure that 1196caf54c4fSMartin Matuska.Nm 1197caf54c4fSMartin Matuskawill not overwrite any existing files or the 1198caf54c4fSMartin Matuska.Fl U 1199caf54c4fSMartin Matuskaoption to remove any pre-existing files. 1200caf54c4fSMartin MatuskaYou should generally not extract archives while running with super-user 1201caf54c4fSMartin Matuskaprivileges. 1202caf54c4fSMartin MatuskaNote that the 1203caf54c4fSMartin Matuska.Fl P 1204caf54c4fSMartin Matuskaoption to 1205caf54c4fSMartin Matuska.Nm 1206caf54c4fSMartin Matuskadisables the security checks above and allows you to extract 1207caf54c4fSMartin Matuskaan archive while preserving any absolute pathnames, 1208caf54c4fSMartin Matuska.Pa .. 1209caf54c4fSMartin Matuskacomponents, or symlinks to other directories. 1210caf54c4fSMartin Matuska.Sh SEE ALSO 1211caf54c4fSMartin Matuska.Xr bzip2 1 , 1212caf54c4fSMartin Matuska.Xr compress 1 , 1213caf54c4fSMartin Matuska.Xr cpio 1 , 1214caf54c4fSMartin Matuska.Xr gzip 1 , 1215caf54c4fSMartin Matuska.Xr mt 1 , 1216caf54c4fSMartin Matuska.Xr pax 1 , 1217caf54c4fSMartin Matuska.Xr shar 1 , 1218c5d360f8SMartin Matuska.Xr xz 1 , 1219caf54c4fSMartin Matuska.Xr libarchive 3 , 1220caf54c4fSMartin Matuska.Xr libarchive-formats 5 , 1221caf54c4fSMartin Matuska.Xr tar 5 1222caf54c4fSMartin Matuska.Sh STANDARDS 1223caf54c4fSMartin MatuskaThere is no current POSIX standard for the tar command; it appeared 1224caf54c4fSMartin Matuskain 1225caf54c4fSMartin Matuska.St -p1003.1-96 1226caf54c4fSMartin Matuskabut was dropped from 1227caf54c4fSMartin Matuska.St -p1003.1-2001 . 1228c5d360f8SMartin MatuskaThe options supported by this implementation were developed by surveying a 1229caf54c4fSMartin Matuskanumber of existing tar implementations as well as the old POSIX specification 1230caf54c4fSMartin Matuskafor tar and the current POSIX specification for pax. 1231caf54c4fSMartin Matuska.Pp 1232caf54c4fSMartin MatuskaThe ustar and pax interchange file formats are defined by 1233caf54c4fSMartin Matuska.St -p1003.1-2001 1234caf54c4fSMartin Matuskafor the pax command. 1235caf54c4fSMartin Matuska.Sh HISTORY 1236caf54c4fSMartin MatuskaA 1237caf54c4fSMartin Matuska.Nm tar 1238caf54c4fSMartin Matuskacommand appeared in Seventh Edition Unix, which was released in January, 1979. 1239caf54c4fSMartin MatuskaThere have been numerous other implementations, 1240caf54c4fSMartin Matuskamany of which extended the file format. 1241caf54c4fSMartin MatuskaJohn Gilmore's 1242caf54c4fSMartin Matuska.Nm pdtar 1243caf54c4fSMartin Matuskapublic-domain implementation (circa November, 1987) 1244caf54c4fSMartin Matuskawas quite influential, and formed the basis of GNU tar. 1245caf54c4fSMartin MatuskaGNU tar was included as the standard system tar 1246caf54c4fSMartin Matuskain 1247caf54c4fSMartin Matuska.Fx 1248caf54c4fSMartin Matuskabeginning with 1249caf54c4fSMartin Matuska.Fx 1.0 . 1250caf54c4fSMartin Matuska.Pp 1251caf54c4fSMartin MatuskaThis is a complete re-implementation based on the 1252caf54c4fSMartin Matuska.Xr libarchive 3 1253caf54c4fSMartin Matuskalibrary. 1254c5d360f8SMartin MatuskaIt was first released with 1255c5d360f8SMartin Matuska.Fx 5.4 1256c5d360f8SMartin Matuskain May, 2005. 1257caf54c4fSMartin Matuska.Sh BUGS 1258caf54c4fSMartin MatuskaThis program follows 1259caf54c4fSMartin Matuska.St -p1003.1-96 1260caf54c4fSMartin Matuskafor the definition of the 1261caf54c4fSMartin Matuska.Fl l 1262caf54c4fSMartin Matuskaoption. 1263caf54c4fSMartin MatuskaNote that GNU tar prior to version 1.15 treated 1264caf54c4fSMartin Matuska.Fl l 1265caf54c4fSMartin Matuskaas a synonym for the 1266c5d360f8SMartin Matuska.Fl Fl one-file-system 1267caf54c4fSMartin Matuskaoption. 1268caf54c4fSMartin Matuska.Pp 1269caf54c4fSMartin MatuskaThe 1270caf54c4fSMartin Matuska.Fl C Pa dir 1271caf54c4fSMartin Matuskaoption may differ from historic implementations. 1272caf54c4fSMartin Matuska.Pp 1273caf54c4fSMartin MatuskaAll archive output is written in correctly-sized blocks, even 1274caf54c4fSMartin Matuskaif the output is being compressed. 1275caf54c4fSMartin MatuskaWhether or not the last output block is padded to a full 1276caf54c4fSMartin Matuskablock size varies depending on the format and the 1277caf54c4fSMartin Matuskaoutput device. 1278caf54c4fSMartin MatuskaFor tar and cpio formats, the last block of output is padded 1279caf54c4fSMartin Matuskato a full block size if the output is being 1280caf54c4fSMartin Matuskawritten to standard output or to a character or block device such as 1281caf54c4fSMartin Matuskaa tape drive. 1282caf54c4fSMartin MatuskaIf the output is being written to a regular file, the last block 1283caf54c4fSMartin Matuskawill not be padded. 1284caf54c4fSMartin MatuskaMany compressors, including 1285caf54c4fSMartin Matuska.Xr gzip 1 1286caf54c4fSMartin Matuskaand 1287caf54c4fSMartin Matuska.Xr bzip2 1 , 1288caf54c4fSMartin Matuskacomplain about the null padding when decompressing an archive created by 1289caf54c4fSMartin Matuska.Nm , 1290caf54c4fSMartin Matuskaalthough they still extract it correctly. 1291caf54c4fSMartin Matuska.Pp 1292caf54c4fSMartin MatuskaThe compression and decompression is implemented internally, so 1293caf54c4fSMartin Matuskathere may be insignificant differences between the compressed output 1294caf54c4fSMartin Matuskagenerated by 1295caf54c4fSMartin Matuska.Dl Nm Fl czf Pa - file 1296caf54c4fSMartin Matuskaand that generated by 1297caf54c4fSMartin Matuska.Dl Nm Fl cf Pa - file | Nm gzip 1298caf54c4fSMartin Matuska.Pp 1299caf54c4fSMartin MatuskaThe default should be to read and write archives to the standard I/O paths, 1300caf54c4fSMartin Matuskabut tradition (and POSIX) dictates otherwise. 1301caf54c4fSMartin Matuska.Pp 1302caf54c4fSMartin MatuskaThe 1303caf54c4fSMartin Matuska.Cm r 1304caf54c4fSMartin Matuskaand 1305caf54c4fSMartin Matuska.Cm u 1306caf54c4fSMartin Matuskamodes require that the archive be uncompressed 1307caf54c4fSMartin Matuskaand located in a regular file on disk. 1308caf54c4fSMartin MatuskaOther archives can be modified using 1309caf54c4fSMartin Matuska.Cm c 1310caf54c4fSMartin Matuskamode with the 1311caf54c4fSMartin Matuska.Pa @archive-file 1312caf54c4fSMartin Matuskaextension. 1313caf54c4fSMartin Matuska.Pp 1314caf54c4fSMartin MatuskaTo archive a file called 1315caf54c4fSMartin Matuska.Pa @foo 1316caf54c4fSMartin Matuskaor 1317caf54c4fSMartin Matuska.Pa -foo 1318caf54c4fSMartin Matuskayou must specify it as 1319caf54c4fSMartin Matuska.Pa ./@foo 1320caf54c4fSMartin Matuskaor 1321caf54c4fSMartin Matuska.Pa ./-foo , 1322caf54c4fSMartin Matuskarespectively. 1323caf54c4fSMartin Matuska.Pp 1324caf54c4fSMartin MatuskaIn create mode, a leading 1325caf54c4fSMartin Matuska.Pa ./ 1326caf54c4fSMartin Matuskais always removed. 1327caf54c4fSMartin MatuskaA leading 1328caf54c4fSMartin Matuska.Pa / 1329caf54c4fSMartin Matuskais stripped unless the 1330caf54c4fSMartin Matuska.Fl P 1331caf54c4fSMartin Matuskaoption is specified. 1332caf54c4fSMartin Matuska.Pp 1333caf54c4fSMartin MatuskaThere needs to be better support for file selection on both create 1334caf54c4fSMartin Matuskaand extract. 1335caf54c4fSMartin Matuska.Pp 1336cdf63a70SMartin MatuskaThere is not yet any support for multi-volume archives. 1337caf54c4fSMartin Matuska.Pp 1338caf54c4fSMartin MatuskaConverting between dissimilar archive formats (such as tar and cpio) using the 1339caf54c4fSMartin Matuska.Cm @ Ns Pa - 1340caf54c4fSMartin Matuskaconvention can cause hard link information to be lost. 1341caf54c4fSMartin Matuska(This is a consequence of the incompatible ways that different archive 1342caf54c4fSMartin Matuskaformats store hardlink information.) 1343