PAX(1) BSD General Commands Manual PAX(1)
NAME
pax -- read and write file archives and copy directory hierarchies
SYNOPSIS
pax [-0cdjnOvz] [-E limit] [-f archive] [-G group] [-s replstr] [-T range] [-U user] [pattern ...]
pax -r [-0cDdijknOuvYZz] [-E limit] [-f archive] [-G group] [-o options] [-p string] [-s replstr] [-T range] [-U user] [pattern ...]
pax -w [-0adHijLOPtuvXz] [-B bytes] [-b blocksize] [-f archive] [-G group] [-o options] [-s replstr] [-T range] [-U user] [-x format]
[file ...]
pax -rw [-0DdHijkLlnOPtuvXYZ] [-G group] [-p string] [-s replstr] [-T range] [-U user] [file ...] directory
DESCRIPTION
pax will read, write, and list the members of an archive file and will copy directory hierarchies. pax operation is independent of the spe-
cific archive format and supports a wide variety of different archive formats. A list of supported archive formats can be found under the
description of the -x option.
The presence of the -r and the -w options specifies which of the following functional modes pax will operate under: list, read, write, and
copy.
<none> List. pax will write to standard output a table of contents of the members of the archive file read from standard input, whose path-
names match the specified pattern arguments. The table of contents contains one filename per line and is written using single line
buffering.
-r Read. pax extracts the members of the archive file read from the standard input, with pathnames matching the specified pattern argu-
ments. The archive format and blocking is automatically determined on input. When an extracted file is a directory, the entire file
hierarchy rooted at that directory is extracted. Extracted files are created either at absolute paths (those that begin with a /
character) or relative to the current file hierarchy unless the -s option is used to remove leading slashes or add a relative path
prefix. Files being extracted to absolute paths may overwrite files outside of the current working directory, so care should be
taken when extracting untrusted archives. The setting of ownership, access and modification times, and file mode of the extracted
files are discussed in more detail under the -p option.
-w Write. pax writes an archive containing the file operands to standard output using the specified archive format. When no file oper-
ands are specified, a list of files to copy with one per line is read from standard input. When a file operand is also a directory,
the entire file hierarchy rooted at that directory will be included.
-rw Copy. pax copies the file operands to the destination directory. When no file operands are specified, a list of files to copy with
one per line is read from the standard input. When a file operand is also a directory the entire file hierarchy rooted at that
directory will be included. The effect of the copy is as if the copied files were written to an archive file and then subsequently
extracted, except that there may be hard links between the original and the copied files (see the -l option below).
Warning: The destination directory must not be one of the file operands or a member of a file hierarchy rooted at one of the file op-
erands. The result of a copy under these conditions is unpredictable.
While processing a damaged archive during a read or list operation, pax will attempt to recover from media defects and will search through
the archive to locate and process the largest number of archive members possible (see the -E option for more details on error handling).
The directory operand specifies a destination directory pathname. If the directory operand does not exist, or it is not writable by the
user, or it is not of type directory, pax will exit with a non-zero exit status.
The pattern operand is used to select one or more pathnames of archive members. Archive members are selected using the pattern matching
notation described by glob(3). When the pattern operand is not supplied, all members of the archive will be selected. When a pattern
matches a directory, the entire file hierarchy rooted at that directory will be selected. When a pattern operand does not select at least
one archive member, pax will write these pattern operands in a diagnostic message to standard error and then exit with a non-zero exit sta-
tus.
The file operand specifies the pathname of a file to be copied or archived. When a file operand does not select at least one archive member,
pax will write these file operand pathnames in a diagnostic message to standard error and then exit with a non-zero exit status.
The options are as follows:
-0 Use the NUL ('