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