PAX(1)

NAME
pax - portable archive interchange

SYNOPSIS
pax [ -r ] [ -v ] [ -f archive ] [ -s /old/new/[glpsu] ] [ -z base ] [ pattern ... ]

pax -w [ -a ] [ -v ] [ -f archive ] [ -s /old/new/[glpsu] ] [ -x format ] [ -z base ] [ pathname ... ]

pax -rw [ -v ] [ -s /old/new/[glpsu] ] [ pathname ... ] directory

DESCRIPTION
pax reads and writes archive files in various formats. There are four operation modes controlled by combinations of the -r and -w options.

pax -w writes the files and directories named by the pathname arguments to the standard output together with pathname and status information. A directory pathname argument refers to the files and (recursively) subdirectories of that directory. If no pathname arguments are given then the standard input is read to get a list of pathnames to copy, one pathname per line. In this case only those pathnames appearing on the standard input are copied.

pax -r reads files from the standard input that is assumed to be the result of a previous pax -w command. Only files with names that match any of the pattern arguments are selected. A pattern is given in the name-generating notation of sh(1), except that the / character is also matched. The default if no pattern is given is *, which selects all files. The selected files are conditionally created and copied relative to the current directory tree, subject to the options described below. By default the owner and group of selected files will be that of the current user, and the permissions and modify times will be the same as those in the archive. If the -r option is omitted then a table of contents of the selected files is listed on the standard output.

pax -rw reads the files and directories named in the pathname arguments and copies them to the destination directory. A directory pathname argument refers to the files and (recursively) subdirectories of that directory. If no pathname arguments are given then the standard input is read to get a list of pathnames to copy, one pathname per line. In this case only those pathnames appearing on the standard input are copied. directory must exist before the copy.

The standard archive formats are automatically detected on input. The default output archive format is implementation defined, but may be overridden by the -x option described below. pax archives may be concatenated to combine multiple volumes on a single tape or file. This is accomplished by forcing any format prescribed pad data to be null bytes. Hard links are not maintained between volumes, and delta and base archives cannot be multi-volume.

A single archive may span many files/devices. The second and subsequent file names are prompted for on the terminal input. The response may be:

!command
    Execute command via system(3) and prompt again for file name.

EOF Exit without further processing.

CR  An empty input line retains the previous file name.

pathname
    The file name for the next archive part.

  Basic Options

a   For -w, append files to the end of the archive.

f archive
    archive is the pathname of the input or output archive, overriding the default standard input for -r and -rw or standard output for -w.

s /old/new/[glpu]
    File names and symbolic link text are mapped according to the ed(1) style substitution expression. Any non-null character may be used as a delimiter (/ shown here). Multiple -s expressions may be specified; the expressions are applied from left to right. A trailing l converts the matched string to lower case. A trailing p causes successful mappings to be listed on the standard error. A trailing s stops the substitutions on the current name if the substitution changes the name. A trailing u converts the matched string to upper case. File names that substitute to the null string are ignored on both input and output. The -o physical option inhibits symbolic link text substitution.

v   Produces a verbose table of contents listing on the standard output when both -r and -w are omitted. Otherwise the file names are listed on the standard error as they are encountered.

x format
    Specifies the output archive format. If specified with -rw then the standard input is treated as an archive that is converted to a format archive on the standard output. The input format, which must be one of the following, is automatically determined. The default output format, named by -, is currently cpio. The formats are:
    ansi
        ANSI standard label tape format. Only regular files with simple pathnames are archived. Valid only for blocked devices.
    asc The s5r4 extended cpio(5) character format.
    aschk
        The s5r4 extended cpio(5) character format with header checksum. This format is misnamed crc in the s5r4 documentation.
    binary
        The cpio(5) binary format with symbolic links. This format is obsolete and should not be used on output.
    cpio
        The cpio(5) character format with symbolic links. This is the default output format.
    ibmar
        EBCDIC standard label tape format. Only regular files with simple pathnames are archived. Valid only for tape devices.
    posix
        The IEEE 1003.1b-1990 interchange format, partially compatible with the X3.27 standard labeled tape format.
    portarch
        The s5r2 portable object library format. Valid only on input.
    randarch
        The BSD ranlib object library format. Valid only on input.
    tar The tar(5) format with symbolic links.
    ustar
        The POSIX IEEE Std 1003.1-1988 tar format.
    vdb The virtual database format used by cia(1) and cql(1).
    vmsbackup
        ANSI standard label VMS backup savset tape format. Valid only for input tape devices.
    zip The PKZIP format. The gunzip(1) command is used to uncompress each archive member. Valid only on input.
    format
        Formats can be defined as extensions to the builtin formats. For any non-builtin format format, can be

  Extended Options
All options have long string names specified using -o [no]name[=value];

append
    (-a) For -w, append files to the end of the archive.

atime
    Preserve the access time of all files.

base=path
    (-z) b blocking Set the output blocking size. If no suffix (or a c suffix) is specified then blocking is in 1 character units. A b suffix multiplies blocking by 512 (1 block), a k suffix multiplies blocking by 1024 (1 kilobyte) and an m suffix multiplies blocking by 1048576 (1 megabyte). blocking is automatically determined on input and is ignored for -rw. The default blocking is 10k for block and character special archive files and implementation defined otherwise. The minimum blocking is 1c.

exact
    (-n) For -r the pattern arguments are treated as ordinary file names. Only the first occurrence of each of these files in the input archive is read. pax exits with zero exit status after all files in the list have been read. If one or more files in the list is not found, pax writes a message to standard error for each of these files and exits with a non-zero exit status. The file names are compared before any pathname transformations are applied.

m   File modification times are not retained.

o   Restore file ownership as specified in the archive. The current user must have appropriate privileges.

  Compatibility Options
These options provide functional compatibility with the old cpio(1) and tar(1) commands.

c   Complement the match sense of the pattern arguments.

d   Intermediate directories not explicitly listed in the archive are not created.

i   Interactively rename files. A file is skipped if a null line is entered and pax exits if EOF is encountered.

l   For -r, existing links are preserved when possible. For -rw, files are linked rather than copied when possible.

p   Preserve the access times of input files after they have been copied.

t device
    device is an identifier that names the input or output archive device, overriding the default standard input for -r or standard output for -w. Tape devices may be specified as drive[densityrewind] where drive is a drive number in the range [0-7], density is one of l, m and h for low (800 bpi), medium (1600 bpi - default) and high (6250 bpi) tape densities and rewind is n to inhibit rewinding of the tape device when it is closed. Other forms for device are implementation defined.

u   Copy each file only if it is newer than a pre-existing file with the same name. This option implies -a.

y   Interactively prompt for the disposition of each file. EOF or an input line starting with q causes pax to exit. Otherwise an input line starting with anything other than y causes the file to be ignored.

  Extended Options
These options provide fine archive control, including delta archive operations.

e filter
    Run the filter command on each file to be output. The current name of the file to be output is appended to the filter command string before the command is executed by the shell.

h   Inhibit archive heading and summmary information messages to stderr.

k   For -r continue processing the archive after encountering an error by attempting to locate the next valid entry. This is useful for archives stored on unreliable media.

z base
    Specifies the delta base archive base that is assumed to be the result of a previous pax -w command. For -w the input files are compared with the files in base and file delta information is placed in the output archive using the delta algorithm. For -r the delta information in the input archive is used to update the output files with respect to the files in base. For -rw the delta information in the archive on the standard input is used to generate an archive on the standard output whose entries are updated with respect to the files in base. If base is - or an empty file then the input files are simply compressed. -z - must also be specified to produce a compressed archive for -rw.

B count
    Sets the maximum archive part output character count. pax prompts for the next archive part file name. Valid only with -w.

C   Archive entries smaller than -B maxout must be contained within a single part. Valid only with -B.

L   Copy a logical view of the input files. Symbolic links are followed, causing the pointed to files to be copied rather than the symbolic link information. This is the default.

M message
    Set the end of medium prompt to message. This message is used to prompt interactively for the next tape reel or cartridge in cases where the tape runs out before all files have been copied. message may contain one printf(3) style integer format specification that is replaced with the next part number.

P   Copy a physical view of the input files. Causes symbolic link information to be copied as opposed to the default (logical view) action of following symbolic links and copying the pointed to files.

R option[value][,option[value]...]
    Set record oriented format options. Multiple options may be concatenated using ,. Some options may be fixed for some formats. The options are:
    c   Record data is subject to character set conversions.
    fformat
        Set the output record format to format. The supported record formats are:
        D   Variable length with 4 byte record header. The record size default is 512.
        F   Fixed length with no record header. The record size default is 128.
        S   Spanned variable length with 4 byte record header. The record size default is 0 (no limit).
        U   Variable length with no record header. The output block size matches the size of each output record. The record size default is 512.
        V   Spanned variable length with binary 4 byte record header. The record size default is 0 (no limit). The D format is preferred.

    mpattern
        Only those files with input record format matching pattern are processed.

    p   Partial output blocks are padded to the full blocksize.

    ssize
        Set the output record size to size. size should divide the output blocking.

    vlabel
        Set the output volume label to label. Some formats may truncate and/or case-convert label.

S   Similar to -l except that symbolic links are created.

U id
    Set file ownership to the default of the user named id. Valid only for the super-user.

V   Output a `.' as each file is encountered. This overrides the -v option.

X   Do not cross mount points when searching for files to output.

DIAGNOSTICS
The number of files, blocks, and optionally the number of volumes and media parts are listed on the standard error. For -v the input archive formats are also listed on the standard error.

EXAMPLES

pax -w -t 1m .
    Copies the contents of the current directory to tape drive 1, medium density.

mkdir  newdir
cd  olddir
pax  -rw  .  newdir
    Copies the olddir directory hierarchy to newdir.

SEE ALSO
ar(1), cpio(1), find(1), gunzip(1), gzip(1), ksh(1), tar(1), tw(1) libdelta(3), cpio(5), tar(5)

BUGS
Special privileges may be required to copy special files.
Each archive format has a hard upper limit on member pathname sizes.
Device, user-id and group-id numbers larger than 65535 cause additional header records to be output. These records are ignored by old versions of cpio(1) and tar(1).