1*10c45587Sjmc.\" $OpenBSD: pax.1,v 1.50 2007/03/06 14:40:22 jmc Exp $ 2df930be7Sderaadt.\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $ 3df930be7Sderaadt.\" 4df930be7Sderaadt.\" Copyright (c) 1992 Keith Muller. 5df930be7Sderaadt.\" Copyright (c) 1992, 1993 6df930be7Sderaadt.\" The Regents of the University of California. All rights reserved. 7df930be7Sderaadt.\" 8df930be7Sderaadt.\" This code is derived from software contributed to Berkeley by 9df930be7Sderaadt.\" Keith Muller of the University of California, San Diego. 10df930be7Sderaadt.\" 11df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 12df930be7Sderaadt.\" modification, are permitted provided that the following conditions 13df930be7Sderaadt.\" are met: 14df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 15df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 16df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 17df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 18df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 1929295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors 20df930be7Sderaadt.\" may be used to endorse or promote products derived from this software 21df930be7Sderaadt.\" without specific prior written permission. 22df930be7Sderaadt.\" 23df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26df930be7Sderaadt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33df930be7Sderaadt.\" SUCH DAMAGE. 34df930be7Sderaadt.\" 35df930be7Sderaadt.\" @(#)pax.1 8.4 (Berkeley) 4/18/94 36df930be7Sderaadt.\" 37df930be7Sderaadt.Dd April 18, 1994 38df930be7Sderaadt.Dt PAX 1 39fc8533a3Saaron.Os 40df930be7Sderaadt.Sh NAME 41df930be7Sderaadt.Nm pax 42df930be7Sderaadt.Nd read and write file archives and copy directory hierarchies 43df930be7Sderaadt.Sh SYNOPSIS 44d9bd2a6bSjaredy.Bk -words 45189213daSderaadt.Nm pax 46bb4196c7Sjmc.Op Fl 0cdnOvz 47d9bd2a6bSjaredy.Op Fl E Ar limit 48df930be7Sderaadt.Op Fl f Ar archive 49df930be7Sderaadt.Op Fl G Ar group 50d9bd2a6bSjaredy.Op Fl s Ar replstr 51d9bd2a6bSjaredy.Op Fl T Ar range 52d9bd2a6bSjaredy.Op Fl U Ar user 53df930be7Sderaadt.Op Ar pattern ... 54189213daSderaadt.Nm pax 55df930be7Sderaadt.Fl r 56bb4196c7Sjmc.Op Fl 0cDdiknOuvYZz 57df930be7Sderaadt.Op Fl E Ar limit 58d9bd2a6bSjaredy.Op Fl f Ar archive 59df930be7Sderaadt.Op Fl G Ar group 60d9bd2a6bSjaredy.Op Fl o Ar options 61d9bd2a6bSjaredy.Op Fl p Ar string 62d9bd2a6bSjaredy.Op Fl s Ar replstr 63d9bd2a6bSjaredy.Op Fl T Ar range 64d9bd2a6bSjaredy.Op Fl U Ar user 65df930be7Sderaadt.Op Ar pattern ... 66189213daSderaadt.Nm pax 67df930be7Sderaadt.Fl w 68d9bd2a6bSjaredy.Op Fl 0adHiLOPtuvXz 69df930be7Sderaadt.Op Fl B Ar bytes 70d9bd2a6bSjaredy.Op Fl b Ar blocksize 71d9bd2a6bSjaredy.Op Fl f Ar archive 72d9bd2a6bSjaredy.Op Fl G Ar group 73d9bd2a6bSjaredy.Op Fl o Ar options 74d9bd2a6bSjaredy.Op Fl s Ar replstr 75d9bd2a6bSjaredy.Op Fl T Ar range 76d9bd2a6bSjaredy.Op Fl U Ar user 77d9bd2a6bSjaredy.Op Fl x Ar format 78df930be7Sderaadt.Op Ar file ... 79189213daSderaadt.Nm pax 80bb4196c7Sjmc.Fl rw 81d9bd2a6bSjaredy.Op Fl 0DdHikLlnOPtuvXYZ 82df930be7Sderaadt.Op Fl G Ar group 83d9bd2a6bSjaredy.Op Fl p Ar string 84d9bd2a6bSjaredy.Op Fl s Ar replstr 85d9bd2a6bSjaredy.Op Fl T Ar range 86d9bd2a6bSjaredy.Op Fl U Ar user 87df930be7Sderaadt.Op Ar file ... 88df930be7Sderaadt.Ar directory 89d9bd2a6bSjaredy.Ek 90df930be7Sderaadt.Sh DESCRIPTION 91f11c8a18Saaron.Nm 92d9bd2a6bSjaredywill read, write, and list the members of an archive file 93df930be7Sderaadtand will copy directory hierarchies. 94f11c8a18Saaron.Nm 95d9bd2a6bSjaredyoperation is independent of the specific archive format 96df930be7Sderaadtand supports a wide variety of different archive formats. 97df930be7SderaadtA list of supported archive formats can be found under the description of the 98df930be7Sderaadt.Fl x 99df930be7Sderaadtoption. 100df930be7Sderaadt.Pp 101df930be7SderaadtThe presence of the 102df930be7Sderaadt.Fl r 103df930be7Sderaadtand the 104df930be7Sderaadt.Fl w 105df930be7Sderaadtoptions specifies which of the following functional modes 106f11c8a18Saaron.Nm 107df930be7Sderaadtwill operate under: 108df930be7Sderaadt.Em list , read , write , 109df930be7Sderaadtand 110df930be7Sderaadt.Em copy . 111df930be7Sderaadt.Bl -tag -width 6n 112d9bd2a6bSjaredy.It \*(Ltnone\*(Gt 113df930be7Sderaadt.Em List . 114f11c8a18Saaron.Nm 115cdba0873Saaronwill write to standard output 116df930be7Sderaadta table of contents of the members of the archive file read from 117cdba0873Saaronstandard input, whose pathnames match the specified 118d9bd2a6bSjaredy.Ar pattern 119d9bd2a6bSjaredyarguments. 120df930be7SderaadtThe table of contents contains one filename per line 121df930be7Sderaadtand is written using single line buffering. 122df930be7Sderaadt.It Fl r 123df930be7Sderaadt.Em Read . 124f11c8a18Saaron.Nm 125cdba0873Saaronextracts the members of the archive file read from the standard input, 126df930be7Sderaadtwith pathnames matching the specified 127d9bd2a6bSjaredy.Ar pattern 128d9bd2a6bSjaredyarguments. 129df930be7SderaadtThe archive format and blocking is automatically determined on input. 130df930be7SderaadtWhen an extracted file is a directory, the entire file hierarchy 131df930be7Sderaadtrooted at that directory is extracted. 132df930be7SderaadtAll extracted files are created relative to the current file hierarchy. 133df930be7SderaadtThe setting of ownership, access and modification times, and file mode of 134df930be7Sderaadtthe extracted files are discussed in more detail under the 135df930be7Sderaadt.Fl p 136df930be7Sderaadtoption. 137df930be7Sderaadt.It Fl w 138df930be7Sderaadt.Em Write . 139f11c8a18Saaron.Nm 140df930be7Sderaadtwrites an archive containing the 141df930be7Sderaadt.Ar file 142cdba0873Saaronoperands to standard output 143df930be7Sderaadtusing the specified archive format. 144df930be7SderaadtWhen no 145df930be7Sderaadt.Ar file 146df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from 147cdba0873Saaronstandard input. 148df930be7SderaadtWhen a 149df930be7Sderaadt.Ar file 150df930be7Sderaadtoperand is also a directory, the entire file hierarchy rooted 151df930be7Sderaadtat that directory will be included. 152bb4196c7Sjmc.It Fl rw 153df930be7Sderaadt.Em Copy . 154f11c8a18Saaron.Nm 155df930be7Sderaadtcopies the 156df930be7Sderaadt.Ar file 157df930be7Sderaadtoperands to the destination 158df930be7Sderaadt.Ar directory . 159df930be7SderaadtWhen no 160df930be7Sderaadt.Ar file 161df930be7Sderaadtoperands are specified, a list of files to copy with one per line is read from 162cdba0873Saaronthe standard input. 163df930be7SderaadtWhen a 164df930be7Sderaadt.Ar file 165df930be7Sderaadtoperand is also a directory the entire file 166df930be7Sderaadthierarchy rooted at that directory will be included. 167df930be7SderaadtThe effect of the 168df930be7Sderaadt.Em copy 169df930be7Sderaadtis as if the copied files were written to an archive file and then 170df930be7Sderaadtsubsequently extracted, except that there may be hard links between 171df930be7Sderaadtthe original and the copied files (see the 172df930be7Sderaadt.Fl l 173df930be7Sderaadtoption below). 174df930be7Sderaadt.Pp 175d9bd2a6bSjaredy.Sy Warning : 176df930be7SderaadtThe destination 177df930be7Sderaadt.Ar directory 178df930be7Sderaadtmust not be one of the 179df930be7Sderaadt.Ar file 180df930be7Sderaadtoperands or a member of a file hierarchy rooted at one of the 181df930be7Sderaadt.Ar file 182df930be7Sderaadtoperands. 183df930be7SderaadtThe result of a 184df930be7Sderaadt.Em copy 185df930be7Sderaadtunder these conditions is unpredictable. 186df930be7Sderaadt.El 187df930be7Sderaadt.Pp 188df930be7SderaadtWhile processing a damaged archive during a 189df930be7Sderaadt.Em read 190df930be7Sderaadtor 191df930be7Sderaadt.Em list 192df930be7Sderaadtoperation, 193f11c8a18Saaron.Nm 194df930be7Sderaadtwill attempt to recover from media defects and will search through the archive 195df930be7Sderaadtto locate and process the largest number of archive members possible (see the 196df930be7Sderaadt.Fl E 197df930be7Sderaadtoption for more details on error handling). 19838a123d1Saaron.Pp 199df930be7SderaadtThe 200df930be7Sderaadt.Ar directory 201df930be7Sderaadtoperand specifies a destination directory pathname. 202df930be7SderaadtIf the 203df930be7Sderaadt.Ar directory 204df930be7Sderaadtoperand does not exist, or it is not writable by the user, 205df930be7Sderaadtor it is not of type directory, 206f11c8a18Saaron.Nm 207df930be7Sderaadtwill exit with a non-zero exit status. 208df930be7Sderaadt.Pp 209df930be7SderaadtThe 210df930be7Sderaadt.Ar pattern 211df930be7Sderaadtoperand is used to select one or more pathnames of archive members. 212df930be7SderaadtArchive members are selected using the pattern matching notation described 213df930be7Sderaadtby 214d9bd2a6bSjaredy.Xr glob 3 . 215df930be7SderaadtWhen the 216df930be7Sderaadt.Ar pattern 217df930be7Sderaadtoperand is not supplied, all members of the archive will be selected. 218df930be7SderaadtWhen a 219df930be7Sderaadt.Ar pattern 220df930be7Sderaadtmatches a directory, the entire file hierarchy rooted at that directory will 221df930be7Sderaadtbe selected. 222df930be7SderaadtWhen a 223df930be7Sderaadt.Ar pattern 224df930be7Sderaadtoperand does not select at least one archive member, 225f11c8a18Saaron.Nm 226df930be7Sderaadtwill write these 227df930be7Sderaadt.Ar pattern 2286339491eSjmcoperands in a diagnostic message to standard error 229df930be7Sderaadtand then exit with a non-zero exit status. 230df930be7Sderaadt.Pp 231df930be7SderaadtThe 232df930be7Sderaadt.Ar file 233df930be7Sderaadtoperand specifies the pathname of a file to be copied or archived. 234df930be7SderaadtWhen a 235df930be7Sderaadt.Ar file 236df930be7Sderaadtoperand does not select at least one archive member, 237f11c8a18Saaron.Nm 238df930be7Sderaadtwill write these 239df930be7Sderaadt.Ar file 240cdba0873Saaronoperand pathnames in a diagnostic message to standard error 241df930be7Sderaadtand then exit with a non-zero exit status. 24238a123d1Saaron.Pp 2438cf461a5SaaronThe options are as follows: 244f1ba3473Saaron.Bl -tag -width Ds 245e70d39b4Sjaredy.It Fl 0 246e70d39b4SjaredyUse the NUL 247e70d39b4Sjaredy.Pq Ql \e0 248e70d39b4Sjaredycharacter as a pathname terminator, instead of newline 249e70d39b4Sjaredy.Pq Ql \en . 250e70d39b4SjaredyThis applies only to the pathnames read from standard input in 251e70d39b4Sjaredythe write and copy modes, 252e70d39b4Sjaredyand to the pathnames written to standard output in list mode. 253e70d39b4SjaredyThis option is expected to be used in concert with the 254e70d39b4Sjaredy.Fl print0 255e70d39b4Sjaredyfunction in 256e70d39b4Sjaredy.Xr find 1 257e70d39b4Sjaredyor the 258e70d39b4Sjaredy.Fl 0 259e70d39b4Sjaredyflag in 260e70d39b4Sjaredy.Xr xargs 1 . 261df930be7Sderaadt.It Fl a 262d9bd2a6bSjaredyAppend the given 263d9bd2a6bSjaredy.Ar file 264d9bd2a6bSjaredyoperands 265df930be7Sderaadtto the end of an archive that was previously written. 266df930be7SderaadtIf an archive format is not specified with a 267df930be7Sderaadt.Fl x 268df930be7Sderaadtoption, the format currently being used in the archive will be selected. 269df930be7SderaadtAny attempt to append to an archive in a format different from the 270df930be7Sderaadtformat already used in the archive will cause 271f11c8a18Saaron.Nm 272df930be7Sderaadtto exit immediately 273df930be7Sderaadtwith a non-zero exit status. 274df930be7SderaadtThe blocking size used in the archive volume where writing starts 275df930be7Sderaadtwill continue to be used for the remainder of that archive volume. 276df930be7Sderaadt.Pp 277d9bd2a6bSjaredy.Sy Warning : 278df930be7SderaadtMany storage devices are not able to support the operations necessary 279df930be7Sderaadtto perform an append operation. 280df930be7SderaadtAny attempt to append to an archive stored on such a device may damage the 281df930be7Sderaadtarchive or have other unpredictable results. 282df930be7SderaadtTape drives in particular are more likely to not support an append operation. 283df930be7SderaadtAn archive stored in a regular file system file or on a disk device will 284df930be7Sderaadtusually support an append operation. 285e70d39b4Sjaredy.It Fl B Ar bytes 286e70d39b4SjaredyLimit the number of bytes written to a single archive volume to 287e70d39b4Sjaredy.Ar bytes . 288e70d39b4SjaredyThe 289e70d39b4Sjaredy.Ar bytes 290e70d39b4Sjaredylimit can end with 291e70d39b4Sjaredy.Sq Li m , 292e70d39b4Sjaredy.Sq Li k , 293e70d39b4Sjaredyor 294e70d39b4Sjaredy.Sq Li b 295e70d39b4Sjaredyto specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively. 296e70d39b4SjaredyA pair of 297e70d39b4Sjaredy.Ar bytes 298e70d39b4Sjaredylimits can be separated by 299e70d39b4Sjaredy.Sq Li x 300e70d39b4Sjaredyto indicate a product. 301e70d39b4Sjaredy.Pp 302e70d39b4Sjaredy.Em Warning : 303e70d39b4SjaredyOnly use this option when writing an archive to a device which supports 304e70d39b4Sjaredyan end of file read condition based on last (or largest) write offset 305e70d39b4Sjaredy(such as a regular file or a tape drive). 306e70d39b4SjaredyThe use of this option with a floppy or hard disk is not recommended. 307df930be7Sderaadt.It Fl b Ar blocksize 308df930be7SderaadtWhen 309df930be7Sderaadt.Em writing 310df930be7Sderaadtan archive, 311df930be7Sderaadtblock the output at a positive decimal integer number of 312df930be7Sderaadtbytes per write to the archive file. 313df930be7SderaadtThe 314df930be7Sderaadt.Ar blocksize 315ea4b1a1aSmillertmust be a multiple of 512 bytes with a maximum of 64512 bytes. 316bdbe3165SjmcArchive block sizes larger than 32256 bytes violate the 317ea4b1a1aSmillert.Tn POSIX 318ea4b1a1aSmillertstandard and will not be portable to all systems. 319df930be7SderaadtA 320df930be7Sderaadt.Ar blocksize 321df930be7Sderaadtcan end with 322f81d96dfSaaron.Sq Li k 323df930be7Sderaadtor 324f81d96dfSaaron.Sq Li b 325df930be7Sderaadtto specify multiplication by 1024 (1K) or 512, respectively. 326df930be7SderaadtA pair of 327df930be7Sderaadt.Ar blocksizes 328df930be7Sderaadtcan be separated by 329f81d96dfSaaron.Sq Li x 330df930be7Sderaadtto indicate a product. 331df930be7SderaadtA specific archive device may impose additional restrictions on the size 332df930be7Sderaadtof blocking it will support. 333df930be7SderaadtWhen blocking is not specified, the default 334df930be7Sderaadt.Ar blocksize 335df930be7Sderaadtis dependent on the specific archive format being used (see the 336df930be7Sderaadt.Fl x 337df930be7Sderaadtoption). 338df930be7Sderaadt.It Fl c 339df930be7SderaadtMatch all file or archive members 340df930be7Sderaadt.Em except 341df930be7Sderaadtthose specified by the 342df930be7Sderaadt.Ar pattern 343df930be7Sderaadtand 344df930be7Sderaadt.Ar file 345df930be7Sderaadtoperands. 346e70d39b4Sjaredy.It Fl D 347e70d39b4SjaredyThis option is the same as the 348e70d39b4Sjaredy.Fl u 349e70d39b4Sjaredyoption, except that the file inode change time is checked instead of the 350e70d39b4Sjaredyfile modification time. 351e70d39b4SjaredyThe file inode change time can be used to select files whose inode information 352e70d39b4Sjaredy(e.g., UID, GID, etc.) is newer than a copy of the file in the destination 353e70d39b4Sjaredy.Ar directory . 354df930be7Sderaadt.It Fl d 355df930be7SderaadtCause files of type directory being copied or archived, or archive members of 356df930be7Sderaadttype directory being extracted, to match only the directory file or archive 357df930be7Sderaadtmember and not the file hierarchy rooted at the directory. 358e70d39b4Sjaredy.It Fl E Ar limit 359e70d39b4SjaredyLimit the number of consecutive read faults while trying to read a flawed 360e70d39b4Sjaredyarchive to 361e70d39b4Sjaredy.Ar limit . 362e70d39b4SjaredyWith a positive 363e70d39b4Sjaredy.Ar limit , 364e70d39b4Sjaredy.Nm 365e70d39b4Sjaredywill attempt to recover from an archive read error and will 366e70d39b4Sjaredycontinue processing starting with the next file stored in the archive. 367e70d39b4SjaredyA 368e70d39b4Sjaredy.Ar limit 369e70d39b4Sjaredyof 0 will cause 370e70d39b4Sjaredy.Nm 371e70d39b4Sjaredyto stop operation after the first read error is detected on an archive volume. 372e70d39b4SjaredyA 373e70d39b4Sjaredy.Ar limit 374e70d39b4Sjaredyof 375e70d39b4Sjaredy.Li NONE 376e70d39b4Sjaredywill cause 377e70d39b4Sjaredy.Nm 378e70d39b4Sjaredyto attempt to recover from read errors forever. 379e70d39b4SjaredyThe default 380e70d39b4Sjaredy.Ar limit 381e70d39b4Sjaredyis a small positive number of retries. 382e70d39b4Sjaredy.Pp 383e70d39b4Sjaredy.Em Warning : 384e70d39b4SjaredyUsing this option with 385e70d39b4Sjaredy.Li NONE 386e70d39b4Sjaredyshould be used with extreme caution as 387e70d39b4Sjaredy.Nm 388e70d39b4Sjaredymay get stuck in an infinite loop on a very badly flawed archive. 389df930be7Sderaadt.It Fl f Ar archive 390df930be7SderaadtSpecify 391df930be7Sderaadt.Ar archive 392df930be7Sderaadtas the pathname of the input or output archive, overriding the default 393cdba0873Saaronstandard input (for 394df930be7Sderaadt.Em list 395df930be7Sderaadtand 396df930be7Sderaadt.Em read ) 397cdba0873Saaronor standard output 398df930be7Sderaadt(for 399df930be7Sderaadt.Em write ) . 400df930be7SderaadtA single archive may span multiple files and different archive devices. 401df930be7SderaadtWhen required, 402f11c8a18Saaron.Nm 403df930be7Sderaadtwill prompt for the pathname of the file or device of the next volume in the 404df930be7Sderaadtarchive. 405e70d39b4Sjaredy.It Fl G Ar group 406e70d39b4SjaredySelect a file based on its 407e70d39b4Sjaredy.Ar group 408e70d39b4Sjaredyname, or when starting with a 409e70d39b4Sjaredy.Cm # , 410e70d39b4Sjaredya numeric GID. 411e70d39b4SjaredyA 412e70d39b4Sjaredy.Ql \e 413e70d39b4Sjaredycan be used to escape the 414e70d39b4Sjaredy.Cm # . 415e70d39b4SjaredyMultiple 416e70d39b4Sjaredy.Fl G 417e70d39b4Sjaredyoptions may be supplied and checking stops with the first match. 418e70d39b4Sjaredy.It Fl H 419e70d39b4SjaredyFollow only command-line symbolic links while performing a physical file 420e70d39b4Sjaredysystem traversal. 421df930be7Sderaadt.It Fl i 422df930be7SderaadtInteractively rename files or archive members. 423df930be7SderaadtFor each archive member matching a 424df930be7Sderaadt.Ar pattern 425df930be7Sderaadtoperand or each file matching a 426df930be7Sderaadt.Ar file 427df930be7Sderaadtoperand, 428f11c8a18Saaron.Nm 429df930be7Sderaadtwill prompt to 430df930be7Sderaadt.Pa /dev/tty 4311fd45b44Saarongiving the name of the file, its file mode, and its modification time. 432f11c8a18Saaron.Nm 433df930be7Sderaadtwill then read a line from 434df930be7Sderaadt.Pa /dev/tty . 435df930be7SderaadtIf this line is blank, the file or archive member is skipped. 436df930be7SderaadtIf this line consists of a single period, the 437df930be7Sderaadtfile or archive member is processed with no modification to its name. 438df930be7SderaadtOtherwise, its name is replaced with the contents of the line. 439f11c8a18Saaron.Nm 440df930be7Sderaadtwill immediately exit with a non-zero exit status if 441cdba0873Saaron.Dv EOF 442df930be7Sderaadtis encountered when reading a response or if 443df930be7Sderaadt.Pa /dev/tty 444df930be7Sderaadtcannot be opened for reading and writing. 445df930be7Sderaadt.It Fl k 446df930be7SderaadtDo not overwrite existing files. 447e70d39b4Sjaredy.It Fl L 448e70d39b4SjaredyFollow all symbolic links to perform a logical file system traversal. 449df930be7Sderaadt.It Fl l 450b3119326Saaron(The lowercase letter 4510cd08285Sjmc.Dq ell . ) 452b3119326SaaronLink files. 453df930be7SderaadtIn the 454df930be7Sderaadt.Em copy 455f81d96dfSaaronmode 456f81d96dfSaaron.Pq Fl r Fl w , 457df930be7Sderaadthard links are made between the source and destination file hierarchies 458df930be7Sderaadtwhenever possible. 459df930be7Sderaadt.It Fl n 460df930be7SderaadtSelect the first archive member that matches each 461df930be7Sderaadt.Ar pattern 462df930be7Sderaadtoperand. 463df930be7SderaadtNo more than one archive member is matched for each 464df930be7Sderaadt.Ar pattern . 465df930be7SderaadtWhen members of type directory are matched, the file hierarchy rooted at that 466df930be7Sderaadtdirectory is also matched (unless 467df930be7Sderaadt.Fl d 468df930be7Sderaadtis also specified). 469e70d39b4Sjaredy.It Fl O 470e70d39b4SjaredyForce the archive to be one volume. 471e70d39b4SjaredyIf a volume ends prematurely, 472e70d39b4Sjaredy.Nm 473e70d39b4Sjaredywill not prompt for a new volume. 474e70d39b4SjaredyThis option can be useful for 475e70d39b4Sjaredyautomated tasks where error recovery cannot be performed by a human. 476df930be7Sderaadt.It Fl o Ar options 477df930be7SderaadtInformation to modify the algorithm for extracting or writing archive files 478df930be7Sderaadtwhich is specific to the archive format specified by 479df930be7Sderaadt.Fl x . 480df930be7SderaadtIn general, 481df930be7Sderaadt.Ar options 482df930be7Sderaadttake the form: 483d741230eSjmc.Ar name Ns = Ns Ar value . 484d9bd2a6bSjaredy.Pp 485d9bd2a6bSjaredyThe following options are available for the old 486d9bd2a6bSjaredy.Bx 487d9bd2a6bSjaredy.Em tar 488d9bd2a6bSjaredyformat: 489d9bd2a6bSjaredy.Pp 490d9bd2a6bSjaredy.Bl -tag -width Ds -compact 491d9bd2a6bSjaredy.It Cm nodir 492d9bd2a6bSjaredy.It Cm write_opt=nodir 493d9bd2a6bSjaredyWhen writing archives, omit the storage of directories. 494d9bd2a6bSjaredy.El 495e70d39b4Sjaredy.It Fl P 496e70d39b4SjaredyDo not follow symbolic links, perform a physical file system traversal. 497e70d39b4SjaredyThis is the default mode. 498df930be7Sderaadt.It Fl p Ar string 499df930be7SderaadtSpecify one or more file characteristic options (privileges). 500df930be7SderaadtThe 501df930be7Sderaadt.Ar string 502df930be7Sderaadtoption-argument is a string specifying file characteristics to be retained or 503df930be7Sderaadtdiscarded on extraction. 504df930be7SderaadtThe string consists of the specification characters 505df930be7Sderaadt.Cm a , e , m , o , 506df930be7Sderaadtand 507df930be7Sderaadt.Cm p . 508df930be7SderaadtMultiple characteristics can be concatenated within the same string 509df930be7Sderaadtand multiple 510df930be7Sderaadt.Fl p 511df930be7Sderaadtoptions can be specified. 512ff488c0dSjmcThe meanings of the specification characters are as follows: 513df930be7Sderaadt.Bl -tag -width 2n 514df930be7Sderaadt.It Cm a 515df930be7SderaadtDo not preserve file access times. 516df930be7SderaadtBy default, file access times are preserved whenever possible. 517df930be7Sderaadt.It Cm e 518d9bd2a6bSjaredy.Dq Preserve everything , 519df930be7Sderaadtthe user ID, group ID, file mode bits, 520df930be7Sderaadtfile access time, and file modification time. 521df930be7SderaadtThis is intended to be used by 522df930be7Sderaadt.Em root , 523df930be7Sderaadtsomeone with all the appropriate privileges, in order to preserve all 524df930be7Sderaadtaspects of the files as they are recorded in the archive. 525df930be7SderaadtThe 526df930be7Sderaadt.Cm e 527df930be7Sderaadtflag is the sum of the 528df930be7Sderaadt.Cm o 529df930be7Sderaadtand 530df930be7Sderaadt.Cm p 531df930be7Sderaadtflags. 532df930be7Sderaadt.It Cm m 533df930be7SderaadtDo not preserve file modification times. 534df930be7SderaadtBy default, file modification times are preserved whenever possible. 535df930be7Sderaadt.It Cm o 536df930be7SderaadtPreserve the user ID and group ID. 537df930be7Sderaadt.It Cm p 538d9bd2a6bSjaredy.Dq Preserve 539df930be7Sderaadtthe file mode bits. 5406339491eSjmcThis is intended to be used by a 541df930be7Sderaadt.Em user 542df930be7Sderaadtwith regular privileges who wants to preserve all aspects of the file other 543df930be7Sderaadtthan the ownership. 544df930be7SderaadtThe file times are preserved by default, but two other flags are offered to 545df930be7Sderaadtdisable this and use the time of extraction instead. 546df930be7Sderaadt.El 547df930be7Sderaadt.Pp 548df930be7SderaadtIn the preceding list, 549df930be7Sderaadt.Sq preserve 550df930be7Sderaadtindicates that an attribute stored in the archive is given to the 551df930be7Sderaadtextracted file, subject to the permissions of the invoking 552df930be7Sderaadtprocess. 553df930be7SderaadtOtherwise the attribute of the extracted file is determined as 554df930be7Sderaadtpart of the normal file creation action. 555df930be7SderaadtIf neither the 556df930be7Sderaadt.Cm e 557df930be7Sderaadtnor the 558df930be7Sderaadt.Cm o 559df930be7Sderaadtspecification character is specified, or the user ID and group ID are not 560df930be7Sderaadtpreserved for any reason, 561f11c8a18Saaron.Nm 562df930be7Sderaadtwill not set the 563df930be7Sderaadt.Dv S_ISUID 564df930be7Sderaadt.Em ( setuid ) 565df930be7Sderaadtand 566df930be7Sderaadt.Dv S_ISGID 567df930be7Sderaadt.Em ( setgid ) 568df930be7Sderaadtbits of the file mode. 569df930be7SderaadtIf the preservation of any of these items fails for any reason, 570f11c8a18Saaron.Nm 571cdba0873Saaronwill write a diagnostic message to standard error. 572df930be7SderaadtFailure to preserve these items will affect the final exit status, 573df930be7Sderaadtbut will not cause the extracted file to be deleted. 574df930be7SderaadtIf the file characteristic letters in any of the string option-arguments are 575df930be7Sderaadtduplicated or conflict with each other, the one(s) given last will take 576df930be7Sderaadtprecedence. 577df930be7SderaadtFor example, if 578d9bd2a6bSjaredy.Fl p Ar eme 579df930be7Sderaadtis specified, file modification times are still preserved. 580e70d39b4Sjaredy.It Fl r 581e70d39b4SjaredyRead an archive file from standard input 582e70d39b4Sjaredyand extract the specified 583e70d39b4Sjaredy.Ar file 584e70d39b4Sjaredyoperands. 585e70d39b4SjaredyIf any intermediate directories are needed in order to extract an archive 586e70d39b4Sjaredymember, these directories will be created as if 587e70d39b4Sjaredy.Xr mkdir 2 588e70d39b4Sjaredywas called with the bitwise inclusive 589e70d39b4Sjaredy.Tn OR 590e70d39b4Sjaredyof 591e70d39b4Sjaredy.Dv S_IRWXU , S_IRWXG , 592e70d39b4Sjaredyand 593e70d39b4Sjaredy.Dv S_IRWXO 594e70d39b4Sjaredyas the mode argument. 595e70d39b4SjaredyWhen the selected archive format supports the specification of linked 596e70d39b4Sjaredyfiles and these files cannot be linked while the archive is being extracted, 597e70d39b4Sjaredy.Nm 598e70d39b4Sjaredywill write a diagnostic message to standard error 599e70d39b4Sjaredyand exit with a non-zero exit status at the completion of operation. 600df930be7Sderaadt.It Fl s Ar replstr 601d9bd2a6bSjaredyModify the archive member names according to the substitution expression 602df930be7Sderaadt.Ar replstr , 603df930be7Sderaadtusing the syntax of the 604df930be7Sderaadt.Xr ed 1 605df930be7Sderaadtutility regular expressions. 606d9bd2a6bSjaredy.Ar file 607d9bd2a6bSjaredyor 608d9bd2a6bSjaredy.Ar pattern 609d9bd2a6bSjaredyarguments may be given to restrict the list of archive members to those 610d9bd2a6bSjaredyspecified. 611d9bd2a6bSjaredy.Pp 612ff488c0dSjmcThe format of these regular expressions is: 613d9bd2a6bSjaredy.Pp 614df930be7Sderaadt.Dl /old/new/[gp] 615d9bd2a6bSjaredy.Pp 616df930be7SderaadtAs in 617df930be7Sderaadt.Xr ed 1 , 618d9bd2a6bSjaredy.Ar old 619d9bd2a6bSjaredyis a basic regular expression (see 620d9bd2a6bSjaredy.Xr re_format 7 ) 621d9bd2a6bSjaredyand 622d9bd2a6bSjaredy.Ar new 623cdba0873Saaroncan contain an ampersand 624cdba0873Saaron.Pq Ql & , 625d9bd2a6bSjaredy.Ql \e Ns Em n 626cdba0873Saaron(where 627d9bd2a6bSjaredy.Em n 628cdba0873Saaronis a digit) back-references, 629df930be7Sderaadtor subexpression matching. 630df930be7SderaadtThe 631d9bd2a6bSjaredy.Ar old 632cdba0873Saaronstring may also contain newline characters. 633cdba0873SaaronAny non-null character can be used as a delimiter 634cdba0873Saaron.Po 635cdba0873Saaron.Ql / 636cdba0873Saaronis shown here 637cdba0873Saaron.Pc . 638df930be7SderaadtMultiple 639df930be7Sderaadt.Fl s 640df930be7Sderaadtexpressions can be specified. 641df930be7SderaadtThe expressions are applied in the order they are specified on the 642df930be7Sderaadtcommand line, terminating with the first successful substitution. 643d9bd2a6bSjaredy.Pp 644df930be7SderaadtThe optional trailing 645df930be7Sderaadt.Cm g 646ff488c0dSjmccontinues to apply the substitution expression to the pathname substring, 647df930be7Sderaadtwhich starts with the first character following the end of the last successful 6488c926583Saaronsubstitution. 6498c926583SaaronThe first unsuccessful substitution stops the operation of the 650df930be7Sderaadt.Cm g 651df930be7Sderaadtoption. 652df930be7SderaadtThe optional trailing 653df930be7Sderaadt.Cm p 654df930be7Sderaadtwill cause the final result of a successful substitution to be written to 655cdba0873Saaronstandard error in the following format: 656d9bd2a6bSjaredy.Pp 657bb4196c7Sjmc.D1 Em original-pathname No \*(Gt\*(Gt Em new-pathname 658d9bd2a6bSjaredy.Pp 659df930be7SderaadtFile or archive member names that substitute to the empty string 660df930be7Sderaadtare not selected and will be skipped. 661e70d39b4Sjaredy.It Fl T Ar range 662e70d39b4SjaredyAllow files to be selected based on a file modification or inode change 663e70d39b4Sjaredytime falling within the specified time range. 664e70d39b4SjaredyThe range has the format: 665e70d39b4Sjaredy.Sm off 666e70d39b4Sjaredy.Bd -filled -offset indent 667e70d39b4Sjaredy.Oo Ar from_date Oc Oo , 668e70d39b4Sjaredy.Ar to_date Oc Oo / 669e70d39b4Sjaredy.Oo Cm c Oc Op Cm m Oc 670e70d39b4Sjaredy.Ed 671e70d39b4Sjaredy.Sm on 672e70d39b4Sjaredy.Pp 673e70d39b4SjaredyThe dates specified by 674e70d39b4Sjaredy.Ar from_date 675e70d39b4Sjaredyto 676e70d39b4Sjaredy.Ar to_date 677e70d39b4Sjaredyare inclusive. 678e70d39b4SjaredyIf only a 679e70d39b4Sjaredy.Ar from_date 680e70d39b4Sjaredyis supplied, all files with a modification or inode change time 681e70d39b4Sjaredyequal to or younger are selected. 682e70d39b4SjaredyIf only a 683e70d39b4Sjaredy.Ar to_date 684e70d39b4Sjaredyis supplied, all files with a modification or inode change time 685e70d39b4Sjaredyequal to or older will be selected. 686e70d39b4SjaredyWhen the 687e70d39b4Sjaredy.Ar from_date 688e70d39b4Sjaredyis equal to the 689e70d39b4Sjaredy.Ar to_date , 690e70d39b4Sjaredyonly files with a modification or inode change time of exactly that 691e70d39b4Sjaredytime will be selected. 692e70d39b4Sjaredy.Pp 693e70d39b4SjaredyWhen 694e70d39b4Sjaredy.Nm 695e70d39b4Sjaredyis in the 696e70d39b4Sjaredy.Em write 697e70d39b4Sjaredyor 698e70d39b4Sjaredy.Em copy 699e70d39b4Sjaredymode, the optional trailing field 700e70d39b4Sjaredy.Oo Cm c Oc Op Cm m 701e70d39b4Sjaredycan be used to determine which file time (inode change, file modification or 702e70d39b4Sjaredyboth) are used in the comparison. 703e70d39b4SjaredyIf neither is specified, the default is to use file modification time only. 704e70d39b4SjaredyThe 705e70d39b4Sjaredy.Cm m 706e70d39b4Sjaredyspecifies the comparison of file modification time (the time when 707e70d39b4Sjaredythe file was last written). 708e70d39b4SjaredyThe 709e70d39b4Sjaredy.Cm c 710e70d39b4Sjaredyspecifies the comparison of inode change time (the time when the file 711e70d39b4Sjaredyinode was last changed; e.g., a change of owner, group, mode, etc). 712e70d39b4SjaredyWhen 713e70d39b4Sjaredy.Cm c 714e70d39b4Sjaredyand 715e70d39b4Sjaredy.Cm m 716e70d39b4Sjaredyare both specified, then the modification and inode change times are 717e70d39b4Sjaredyboth compared. 718e70d39b4Sjaredy.Pp 719e70d39b4SjaredyThe inode change time comparison is useful in selecting files whose 720e70d39b4Sjaredyattributes were recently changed or selecting files which were recently 721e70d39b4Sjaredycreated and had their modification time reset to an older time (as what 722e70d39b4Sjaredyhappens when a file is extracted from an archive and the modification time 723e70d39b4Sjaredyis preserved). 724e70d39b4SjaredyTime comparisons using both file times is useful when 725e70d39b4Sjaredy.Nm 726e70d39b4Sjaredyis used to create a time based incremental archive (only files that were 727e70d39b4Sjaredychanged during a specified time range will be archived). 728e70d39b4Sjaredy.Pp 729e70d39b4SjaredyA time range is made up of six different fields and each field must contain two 730e70d39b4Sjaredydigits. 731e70d39b4SjaredyThe format is: 732e70d39b4Sjaredy.Pp 733e70d39b4Sjaredy.Dl [[[[[cc]yy]mm]dd]HH]MM[.SS] 734e70d39b4Sjaredy.Pp 735e70d39b4SjaredyWhere 736e70d39b4Sjaredy.Ar cc 737e70d39b4Sjaredyis the first two digits of the year (the century), 738e70d39b4Sjaredy.Ar yy 739e70d39b4Sjaredyis the last two digits of the year, 740e70d39b4Sjaredythe first 741e70d39b4Sjaredy.Ar mm 742e70d39b4Sjaredyis the month (from 01 to 12), 743e70d39b4Sjaredy.Ar dd 744e70d39b4Sjaredyis the day of the month (from 01 to 31), 745e70d39b4Sjaredy.Ar HH 746e70d39b4Sjaredyis the hour of the day (from 00 to 23), 747e70d39b4Sjaredy.Ar MM 748e70d39b4Sjaredyis the minute (from 00 to 59), 749e70d39b4Sjaredyand 750e70d39b4Sjaredy.Ar SS 751e70d39b4Sjaredyis the seconds (from 00 to 59). 752e70d39b4SjaredyThe minute field 753e70d39b4Sjaredy.Ar MM 754e70d39b4Sjaredyis required, while the other fields are optional and must be added in the 755e70d39b4Sjaredyfollowing order: 756e70d39b4Sjaredy.Ar HH , dd , mm , 757e70d39b4Sjaredy.Ar yy , cc . 758e70d39b4Sjaredy.Pp 759e70d39b4SjaredyThe 760e70d39b4Sjaredy.Ar SS 761e70d39b4Sjaredyfield may be added independently of the other fields. 762e70d39b4SjaredyTime ranges are relative to the current time, so 763e70d39b4Sjaredy.Ic -T 1234/cm 764e70d39b4Sjaredywould select all files with a modification or inode change time 765e70d39b4Sjaredyof 12:34 PM today or later. 766e70d39b4SjaredyMultiple 767e70d39b4Sjaredy.Fl T 768e70d39b4Sjaredytime range can be supplied and checking stops with the first match. 769df930be7Sderaadt.It Fl t 770df930be7SderaadtReset the access times of any file or directory read or accessed by 771f11c8a18Saaron.Nm 772df930be7Sderaadtto be the same as they were before being read or accessed by 773df930be7Sderaadt.Nm pax . 774e70d39b4Sjaredy.It Fl U Ar user 775e70d39b4SjaredySelect a file based on its 776e70d39b4Sjaredy.Ar user 777e70d39b4Sjaredyname, or when starting with a 778e70d39b4Sjaredy.Cm # , 779e70d39b4Sjaredya numeric UID. 780e70d39b4SjaredyA 781e70d39b4Sjaredy.Ql \e 782e70d39b4Sjaredycan be used to escape the 783e70d39b4Sjaredy.Cm # . 784e70d39b4SjaredyMultiple 785e70d39b4Sjaredy.Fl U 786e70d39b4Sjaredyoptions may be supplied and checking stops with the first match. 787df930be7Sderaadt.It Fl u 788df930be7SderaadtIgnore files that are older (having a less recent file modification time) 789df930be7Sderaadtthan a pre-existing file or archive member with the same name. 790df930be7SderaadtDuring 791df930be7Sderaadt.Em read , 792df930be7Sderaadtan archive member with the same name as a file in the file system will be 793df930be7Sderaadtextracted if the archive member is newer than the file. 794df930be7SderaadtDuring 795df930be7Sderaadt.Em write , 796df930be7Sderaadta file system member with the same name as an archive member will be 797df930be7Sderaadtwritten to the archive if it is newer than the archive member. 798df930be7SderaadtDuring 799df930be7Sderaadt.Em copy , 800df930be7Sderaadtthe file in the destination hierarchy is replaced by the file in the source 801df930be7Sderaadthierarchy or by a link to the file in the source hierarchy if the file in 802df930be7Sderaadtthe source hierarchy is newer. 803df930be7Sderaadt.It Fl v 804df930be7SderaadtDuring a 805df930be7Sderaadt.Em list 806df930be7Sderaadtoperation, produce a verbose table of contents using the format of the 807df930be7Sderaadt.Xr ls 1 808df930be7Sderaadtutility with the 809df930be7Sderaadt.Fl l 810df930be7Sderaadtoption. 811df930be7SderaadtFor pathnames representing a hard link to a previous member of the archive, 812df930be7Sderaadtthe output has the format: 813d9bd2a6bSjaredy.Pp 814d9bd2a6bSjaredy.Dl Em ls -l listing Li == Em link-name 815d9bd2a6bSjaredy.Pp 816df930be7SderaadtFor pathnames representing a symbolic link, the output has the format: 817d9bd2a6bSjaredy.Pp 818d9bd2a6bSjaredy.Dl Em ls -l listing Li =\*(Gt Em link-name 819d9bd2a6bSjaredy.Pp 820d9bd2a6bSjaredyWhere 821d9bd2a6bSjaredy.Em ls -l listing 822d9bd2a6bSjaredyis the output format specified by the 823df930be7Sderaadt.Xr ls 1 824df930be7Sderaadtutility when used with the 825df930be7Sderaadt.Fl l 826df930be7Sderaadtoption. 827f81d96dfSaaronOtherwise for all the other operational modes 828d9bd2a6bSjaredy.Po Em read , write , No and Em copy 829f81d96dfSaaron.Pc , 830cdba0873Saaronpathnames are written and flushed to standard error 831cdba0873Saaronwithout a trailing newline 832df930be7Sderaadtas soon as processing begins on that file or 833df930be7Sderaadtarchive member. 834cdba0873SaaronThe trailing newline 835cdba0873Saaronis not buffered and is written only after the file has been read or written. 836e70d39b4Sjaredy.It Fl w 837e70d39b4SjaredyWrite files to the standard output 838e70d39b4Sjaredyin the specified archive format. 839e70d39b4SjaredyWhen no 840e70d39b4Sjaredy.Ar file 841e70d39b4Sjaredyoperands are specified, standard input 842e70d39b4Sjaredyis read for a list of pathnames with one per line without any leading or 843e70d39b4Sjaredytrailing 844e70d39b4Sjaredy.Aq blanks . 845e70d39b4Sjaredy.It Fl X 846e70d39b4SjaredyWhen traversing the file hierarchy specified by a pathname, 847e70d39b4Sjaredydo not descend into directories that have a different device ID. 848e70d39b4SjaredySee the 849e70d39b4Sjaredy.Li st_dev 850e70d39b4Sjaredyfield as described in 851e70d39b4Sjaredy.Xr stat 2 852e70d39b4Sjaredyfor more information about device IDs. 853df930be7Sderaadt.It Fl x Ar format 854df930be7SderaadtSpecify the output archive format, with the default format being 855d9bd2a6bSjaredy.Cm ustar . 856f11c8a18Saaron.Nm 857df930be7Sderaadtcurrently supports the following formats: 858df930be7Sderaadt.Bl -tag -width "sv4cpio" 859d9bd2a6bSjaredy.It Cm bcpio 860df930be7SderaadtThe old binary cpio format. 861df930be7SderaadtThe default blocksize for this format is 5120 bytes. 862df930be7SderaadtThis format is not very portable and should not be used when other formats 863df930be7Sderaadtare available. 864df930be7SderaadtInode and device information about a file (used for detecting file hard links 865ff488c0dSjmcby this format), which may be truncated by this format, is detected by 866f11c8a18Saaron.Nm 867df930be7Sderaadtand is repaired. 868bb4196c7Sjmc.It Cm cpio 869bb4196c7SjmcThe extended cpio interchange format specified in the 870bb4196c7Sjmc.St -p1003.2 871bb4196c7Sjmcstandard. 872bb4196c7SjmcThe default blocksize for this format is 5120 bytes. 873bb4196c7SjmcInode and device information about a file (used for detecting file hard links 874bb4196c7Sjmcby this format), which may be truncated by this format, is detected by 875bb4196c7Sjmc.Nm 876bb4196c7Sjmcand is repaired. 877d9bd2a6bSjaredy.It Cm sv4cpio 878df930be7SderaadtThe System V release 4 cpio. 879df930be7SderaadtThe default blocksize for this format is 5120 bytes. 880df930be7SderaadtInode and device information about a file (used for detecting file hard links 881ff488c0dSjmcby this format), which may be truncated by this format, is detected by 882f11c8a18Saaron.Nm 883df930be7Sderaadtand is repaired. 884d9bd2a6bSjaredy.It Cm sv4crc 885d9bd2a6bSjaredyThe System V release 4 cpio with file CRC checksums. 886df930be7SderaadtThe default blocksize for this format is 5120 bytes. 887df930be7SderaadtInode and device information about a file (used for detecting file hard links 888ff488c0dSjmcby this format), which may be truncated by this format, is detected by 889f11c8a18Saaron.Nm 890df930be7Sderaadtand is repaired. 891d9bd2a6bSjaredy.It Cm tar 892d9bd2a6bSjaredyThe old 893d9bd2a6bSjaredy.Bx 894d9bd2a6bSjaredytar format as found in 895d9bd2a6bSjaredy.Bx 4.3 . 896df930be7SderaadtThe default blocksize for this format is 10240 bytes. 897df930be7SderaadtPathnames stored by this format must be 100 characters or less in length. 898df930be7SderaadtOnly 899df930be7Sderaadt.Em regular 900df930be7Sderaadtfiles, 901df930be7Sderaadt.Em hard links , soft links , 902df930be7Sderaadtand 903df930be7Sderaadt.Em directories 904df930be7Sderaadtwill be archived (other file system types are not supported). 905df930be7SderaadtFor backwards compatibility with even older tar formats, a 906df930be7Sderaadt.Fl o 907df930be7Sderaadtoption can be used when writing an archive to omit the storage of directories. 908df930be7SderaadtThis option takes the form: 909d9bd2a6bSjaredy.Pp 910df930be7Sderaadt.Dl Fl o Cm write_opt=nodir 911d9bd2a6bSjaredy.It Cm ustar 912df930be7SderaadtThe extended tar interchange format specified in the 913df930be7Sderaadt.St -p1003.2 914df930be7Sderaadtstandard. 915df930be7SderaadtThe default blocksize for this format is 10240 bytes. 916c1aa369bSjmcFilenames stored by this format must be 100 characters or less in length; 917c1aa369bSjmcthe total pathname must be 255 characters or less. 918df930be7Sderaadt.El 919df930be7Sderaadt.Pp 920f11c8a18Saaron.Nm 921df930be7Sderaadtwill detect and report any file that it is unable to store or extract 922df930be7Sderaadtas the result of any specific archive format restrictions. 923df930be7SderaadtThe individual archive formats may impose additional restrictions on use. 924df930be7SderaadtTypical archive format restrictions include (but are not limited to): 925f81d96dfSaaronfile pathname length, file size, link pathname length, and the type of the 926f81d96dfSaaronfile. 927df930be7Sderaadt.It Fl Y 928df930be7SderaadtThis option is the same as the 929df930be7Sderaadt.Fl D 930df930be7Sderaadtoption, except that the inode change time is checked using the 931df930be7Sderaadtpathname created after all the file name modifications have completed. 932df930be7Sderaadt.It Fl Z 933df930be7SderaadtThis option is the same as the 934df930be7Sderaadt.Fl u 935df930be7Sderaadtoption, except that the modification time is checked using the 936df930be7Sderaadtpathname created after all the file name modifications have completed. 937e70d39b4Sjaredy.It Fl z 938e70d39b4SjaredyUse 939e70d39b4Sjaredy.Xr gzip 1 940e70d39b4Sjaredyto compress (decompress) the archive while writing (reading). 941e70d39b4SjaredyIncompatible with 942e70d39b4Sjaredy.Fl a . 943df930be7Sderaadt.El 944df930be7Sderaadt.Pp 945f81d96dfSaaronThe options that operate on the names of files or archive members 946f81d96dfSaaron.Po Fl c , 947df930be7Sderaadt.Fl i , 948df930be7Sderaadt.Fl n , 949df930be7Sderaadt.Fl s , 950df930be7Sderaadt.Fl u , 951df930be7Sderaadt.Fl v , 952df930be7Sderaadt.Fl D , 953df930be7Sderaadt.Fl G , 954df930be7Sderaadt.Fl T , 955df930be7Sderaadt.Fl U , 956df930be7Sderaadt.Fl Y , 957df930be7Sderaadtand 958f81d96dfSaaron.Fl Z 959f81d96dfSaaron.Pc 960df930be7Sderaadtinteract as follows. 961df930be7Sderaadt.Pp 962df930be7SderaadtWhen extracting files during a 963df930be7Sderaadt.Em read 964df930be7Sderaadtoperation, archive members are 965df930be7Sderaadt.Sq selected , 966df930be7Sderaadtbased only on the user specified pattern operands as modified by the 967df930be7Sderaadt.Fl c , 968df930be7Sderaadt.Fl n , 969df930be7Sderaadt.Fl u , 970df930be7Sderaadt.Fl D , 971df930be7Sderaadt.Fl G , 972df930be7Sderaadt.Fl T , 973df930be7Sderaadt.Fl U 974df930be7Sderaadtoptions. 975df930be7SderaadtThen any 976df930be7Sderaadt.Fl s 977df930be7Sderaadtand 978df930be7Sderaadt.Fl i 979df930be7Sderaadtoptions will modify in that order, the names of these selected files. 980df930be7SderaadtThen the 981df930be7Sderaadt.Fl Y 982df930be7Sderaadtand 983df930be7Sderaadt.Fl Z 984df930be7Sderaadtoptions will be applied based on the final pathname. 985f81d96dfSaaronFinally, the 986df930be7Sderaadt.Fl v 987df930be7Sderaadtoption will write the names resulting from these modifications. 988df930be7Sderaadt.Pp 989df930be7SderaadtWhen archiving files during a 990df930be7Sderaadt.Em write 991df930be7Sderaadtoperation, or copying files during a 992df930be7Sderaadt.Em copy 993df930be7Sderaadtoperation, archive members are 994df930be7Sderaadt.Sq selected , 995df930be7Sderaadtbased only on the user specified pathnames as modified by the 996df930be7Sderaadt.Fl n , 997df930be7Sderaadt.Fl u , 998df930be7Sderaadt.Fl D , 999df930be7Sderaadt.Fl G , 1000df930be7Sderaadt.Fl T , 1001df930be7Sderaadtand 1002df930be7Sderaadt.Fl U 1003df930be7Sderaadtoptions (the 1004df930be7Sderaadt.Fl D 1005df930be7Sderaadtoption only applies during a copy operation). 1006df930be7SderaadtThen any 1007df930be7Sderaadt.Fl s 1008df930be7Sderaadtand 1009df930be7Sderaadt.Fl i 1010df930be7Sderaadtoptions will modify in that order, the names of these selected files. 1011df930be7SderaadtThen during a 1012df930be7Sderaadt.Em copy 1013df930be7Sderaadtoperation the 1014df930be7Sderaadt.Fl Y 1015df930be7Sderaadtand the 1016df930be7Sderaadt.Fl Z 1017df930be7Sderaadtoptions will be applied based on the final pathname. 1018f81d96dfSaaronFinally, the 1019df930be7Sderaadt.Fl v 1020df930be7Sderaadtoption will write the names resulting from these modifications. 1021df930be7Sderaadt.Pp 1022df930be7SderaadtWhen one or both of the 1023df930be7Sderaadt.Fl u 1024df930be7Sderaadtor 1025df930be7Sderaadt.Fl D 1026df930be7Sderaadtoptions are specified along with the 1027df930be7Sderaadt.Fl n 1028df930be7Sderaadtoption, a file is not considered selected unless it is newer 1029df930be7Sderaadtthan the file to which it is compared. 10300cd08285Sjmc.Sh ENVIRONMENT 10310cd08285Sjmc.Bl -tag -width Fl 10320cd08285Sjmc.It Ev TMPDIR 10330cd08285SjmcPath in which to store temporary files. 10340cd08285Sjmc.El 1035df930be7Sderaadt.Sh EXAMPLES 1036d9bd2a6bSjaredyCopy the contents of the current directory to the device 1037d9bd2a6bSjaredy.Pa /dev/rst0 : 103893256fbcSaaron.Pp 1039d9bd2a6bSjaredy.Dl $ pax -w -f /dev/rst0 \&. 1040df930be7Sderaadt.Pp 1041d9bd2a6bSjaredyGive the verbose table of contents for an archive stored in 1042d9bd2a6bSjaredy.Pa filename : 104393256fbcSaaron.Pp 1044d9bd2a6bSjaredy.Dl $ pax -v -f filename 104593256fbcSaaron.Pp 104693256fbcSaaronThis sequence of commands will copy the entire 1047df930be7Sderaadt.Pa olddir 1048df930be7Sderaadtdirectory hierarchy to 1049d9bd2a6bSjaredy.Pa newdir : 1050d9bd2a6bSjaredy.Bd -literal -offset indent 1051d9bd2a6bSjaredy$ mkdir newdir 1052d9bd2a6bSjaredy$ cd olddir 1053a9710eddSray$ pax -rw . ../newdir 1054d9bd2a6bSjaredy.Ed 1055df930be7Sderaadt.Pp 1056*10c45587SjmcExtract files from the archive 1057*10c45587Sjmc.Pa a.pax . 1058*10c45587SjmcFiles rooted in 1059b3119326Saaron.Pa /usr 1060*10c45587Sjmcare extracted relative to the current working directory; 1061*10c45587Sjmcall other files are extracted to their unmodified path. 1062df930be7Sderaadt.Pp 1063*10c45587Sjmc.Dl $ pax -r -s ',^/usr/,,' -f a.pax 106493256fbcSaaron.Pp 1065d9bd2a6bSjaredyThis can be used to interactively select the files to copy from the 1066d9bd2a6bSjaredycurrent directory to 1067d9bd2a6bSjaredy.Pa dest_dir : 1068df930be7Sderaadt.Pp 1069d9bd2a6bSjaredy.Dl $ pax -rw -i \&. dest_dir 107093256fbcSaaron.Pp 107193256fbcSaaronExtract all files from the archive 1072df930be7Sderaadt.Pa a.pax 1073df930be7Sderaadtwhich are owned by 1074df930be7Sderaadt.Em root 1075df930be7Sderaadtwith group 1076df930be7Sderaadt.Em bin 1077d9bd2a6bSjaredyand preserve all file permissions: 1078df930be7Sderaadt.Pp 1079d9bd2a6bSjaredy.Dl "$ pax -r -pe -U root -G bin -f a.pax" 108093256fbcSaaron.Pp 108193256fbcSaaronUpdate (and list) only those files in the destination directory 1082df930be7Sderaadt.Pa /backup 1083df930be7Sderaadtwhich are older (less recent inode change or file modification times) than 1084df930be7Sderaadtfiles with the same name found in the source file tree 1085d9bd2a6bSjaredy.Pa home : 1086d9bd2a6bSjaredy.Pp 1087d9bd2a6bSjaredy.Dl "$ pax -r -w -v -Y -Z home /backup" 1088e3085f41Saaron.Sh DIAGNOSTICS 1089f11c8a18Saaron.Nm 1090df930be7Sderaadtwill exit with one of the following values: 1091d9bd2a6bSjaredy.Bl -tag -width 2n -offset indent 1092df930be7Sderaadt.It 0 1093df930be7SderaadtAll files were processed successfully. 1094df930be7Sderaadt.It 1 1095df930be7SderaadtAn error occurred. 1096df930be7Sderaadt.El 1097df930be7Sderaadt.Pp 1098df930be7SderaadtWhenever 1099f11c8a18Saaron.Nm 1100df930be7Sderaadtcannot create a file or a link when reading an archive or cannot 1101df930be7Sderaadtfind a file when writing an archive, or cannot preserve the user ID, 1102df930be7Sderaadtgroup ID, or file mode when the 1103df930be7Sderaadt.Fl p 1104cdba0873Saaronoption is specified, a diagnostic message is written to standard error 1105df930be7Sderaadtand a non-zero exit status will be returned, but processing will continue. 1106f81d96dfSaaronIn the case where 1107f11c8a18Saaron.Nm 1108f81d96dfSaaroncannot create a link to a file, 1109f11c8a18Saaron.Nm 1110df930be7Sderaadtwill not create a second copy of the file. 1111df930be7Sderaadt.Pp 1112df930be7SderaadtIf the extraction of a file from an archive is prematurely terminated by 1113df930be7Sderaadta signal or error, 1114f11c8a18Saaron.Nm 1115df930be7Sderaadtmay have only partially extracted a file the user wanted. 1116df930be7SderaadtAdditionally, the file modes of extracted files and directories 1117df930be7Sderaadtmay have incorrect file bits, and the modification and access times may be 1118df930be7Sderaadtwrong. 1119df930be7Sderaadt.Pp 1120df930be7SderaadtIf the creation of an archive is prematurely terminated by a signal or error, 1121f11c8a18Saaron.Nm 1122ff488c0dSjmcmay have only partially created the archive, which may violate the specific 1123df930be7Sderaadtarchive format specification. 1124df930be7Sderaadt.Pp 1125df930be7SderaadtIf while doing a 1126df930be7Sderaadt.Em copy , 1127f11c8a18Saaron.Nm 1128df930be7Sderaadtdetects a file is about to overwrite itself, the file is not copied, 1129cdba0873Saarona diagnostic message is written to standard error 1130df930be7Sderaadtand when 1131f11c8a18Saaron.Nm 1132df930be7Sderaadtcompletes it will exit with a non-zero exit status. 1133e3085f41Saaron.Sh SEE ALSO 1134e3085f41Saaron.Xr cpio 1 , 1135e3085f41Saaron.Xr tar 1 1136e3085f41Saaron.Sh STANDARDS 1137e3085f41SaaronThe 1138e3085f41Saaron.Nm 1139e3085f41Saaronutility is a superset of the 1140e3085f41Saaron.St -p1003.2 1141e3085f41Saaronstandard. 1142e3085f41SaaronThe options 1143d9bd2a6bSjaredy.Fl 0 , 1144e3085f41Saaron.Fl B , 1145e3085f41Saaron.Fl D , 1146e3085f41Saaron.Fl E , 1147e3085f41Saaron.Fl G , 1148e3085f41Saaron.Fl H , 1149e3085f41Saaron.Fl L , 1150da60b202Smillert.Fl O , 1151e3085f41Saaron.Fl P , 1152e3085f41Saaron.Fl T , 1153e3085f41Saaron.Fl U , 1154e3085f41Saaron.Fl Y , 1155e3085f41Saaron.Fl Z , 1156e3085f41Saaronthe archive formats 1157d9bd2a6bSjaredy.Em bcpio , 1158d9bd2a6bSjaredy.Em sv4cpio , 1159d9bd2a6bSjaredy.Em sv4crc , 1160d9bd2a6bSjaredy.Em tar , 1161e3085f41Saaronand the flawed archive handling during 1162d9bd2a6bSjaredy.Em list 1163e3085f41Saaronand 1164d9bd2a6bSjaredy.Em read 1165e3085f41Saaronoperations are extensions to the 1166e3085f41Saaron.Tn POSIX 1167e3085f41Saaronstandard. 11680cd08285Sjmc.Sh AUTHORS 11690cd08285SjmcKeith Muller at the University of California, San Diego. 1170