pax - portable archive exchange
pax [-cdnv] [-E limit] [-f archive] [-s replstr ] ... [-U user ] ...
[-G group ] ... [-T [from_date][,to_date] ] ... [pattern...]
pax -r [-cdiknuvDYZ] [-E limit] [-f archive] [-o options ] ... [-p
string ] ... [-s replstr ] ... [-U user ] ... [-G group ] ...
[-T [from_date][,to_date] ] ... [pattern...]
pax -w [-dituvHLPX] [-b blocksize] [[-a] [-f archive]] [-x format] [-B
bytes] [-s replstr ] ... [-o options ] ... [-U user ] ... [-G
group ] ... [-T [from_date][,to_date]][ /[c][m]]] ... [file...]
pax -rw [-diklntuvDHLPXYZ] [-p string ] ... [-s replstr ] ... [-U user
] ... [-G group ] ... [-T [from_date][,to_date][/[c][m]]] ...
Pax reads and writes archive files which conform to the
Archive/Interchange File Format specified in IEEE Std. 1003.1-1988. Pax
can also read, but not write, a number of other file formats in addition
to those specified in the Archive/Interchange File Format description.
Support for these traditional file formats, such as V7 tar and System V
binary cpio format archives, is provided for backward compatibility and
to maximize portability.
Pax will also support traditional cpio and System V tar interfaces if
invoked with the name "cpio" or "tar" respectively. See the cpio(1) or
tar(1) manual pages for more details.
Combinations of the -r and -w command line arguments specify whether pax
will read, write or list the contents of the specified archive, or move
the specified files to another directory.
The command line arguments are:
-w writes the contents of the file operands to the standard output in
an archive format. If no file operands are specified, a list of
files to copy, one per line, will be read from the standard input. A
file of type directory will include all of the files in the file
hierarchy rooted at the file.
-r Pax extracts the members of the archive file read from the standard
input, with pathnames matching the specified patterns. If an
extracted file is of type directory, the file hierarchy rooted at
that file will be extracted as well. The extracted files is created
relative to the current file hierarchy. By default, the owner and
group of selected files will be that of the invoking process, and
the permissions and modification times will be the sames as those in
The supported archive formats are automatically detected on input.
The default output format is ustar, but may be overridden by the -x
format option described below.
-rw Pax copies the file operands to the destination directory. If no
file operands are specified, a list of files to copy, one per line,
will be read from the standard input. A file of type directory will
include all of the files in the file hierarchy rooted at the file.
The directory named by the directory operand must exist and have the
proper permissions before the copy can occur.
If neither the -r or -w options are given, then pax will list the
contents of the specified archive. In this mode, pax lists normal files
one per line, hard link pathnames as
pathname == linkname
and symbolic link pathnames (if supported by the implementation) as
pathname -> linkname
where pathname is the name of the file being extracted, and linkname is
the name of a file which appeared earlier in the archive.
If the -v option is specified, then pax list normal pathnames in the same
format used by the ls utility with the -l option. Hard links are shown
<ls -l listing> == linkname
and symbolic links (if supported) are shown as
<ls -l listing> -> linkname
Pax is capable of reading and writing archives which span multiple
physical volumes. Upon detecting an end of medium on an archive which is
not yet completed, pax will prompt the user for the next volume of the
archive and will allow the user to specify the location of the next
Options [Toc] [Back]
The following options are available:
-a Append files to the end of archive.
Block the output at blocksize bytes per write to the archive
file. A k suffix multiplies blocking by 1024, a b suffix
multiplies blocking by 512 and a m suffix multiplies blocking
by 1048576 (1 megabyte). For machines with 16-bit int's
(VAXen, XENIX-286, etc.), the maximum buffer size is 32k-1. If
not specified, blocksize is automatically determined on input
and is ignored for -rw.
-c Match all file or archive members except those specified by the
pattern or file operands.
-d Cause files of type directory being copied or archived or
archive members of type directory being extracted to match only
the file or archive member itself and not the file hierarchy
rooted at the file.
The archive option specifies the pathname of the input or
output archive, overriding the default of standard input for -r
or standard output for -w.
-i Interactively rename files. Substitutions specified by -s
options (described below) are performed before requesting the
new file name from the user. A file is skipped if an empty
line is entered and pax exits with an exit status of 0 if EOF
-k Prevent the overwriting of existing files.
-l Files are linked rather than copied when possible.
-n When -r is specified, but -w is not, the pattern arguments are
treated as ordinary file names. Only the first occurrence of
each of these files in the input archive is read. The pax
utility exits with a 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 diagnostic to standard error for each of
the files and exits with a non-zero exit status. the file
names are compared before either the -i, or -s, options are
Provide information to the implementation to modify the
algorithm for extracting or writing files that is specific to
the file format specified by -x.
-p string Specify one or more file characteristic options (privileges).
The string option-argument must be a string specifying file
characteristics to be retained or discarded on extraction. The
string consists of the specification characters a, e, m, o and
p. Multiple characteristics can be concatenated within the same
string and multiple -p options can be specified. The meaning of
the specification characters are as follows:
a Do not preserve file access times.
e Preserve the user ID, group ID, file mode, access time, and
m Do not preserve file modification times.
o Preserve the user ID and group ID.
p Preserve the file mode bits.
In the preceding list, "preserve" indicates that an attribute
stored in the archive will be given to the extracted file,
subject to the permissions of the invoking process; otherwise,
the attribute will be determined as part of the normal file
If neither the e nor the o specification character is
specified, or the user ID and group ID are not preserved for
any reason, pax will not set the S_ISUID and S_ISGID bits of
the file mode.
If the preservation of any of these items fails for any reason,
pax will write a diagnostic message to standard error. Failure
to preserve these items will affect the final exit status, but
will not cause the extracted file to be deleted.
If file-characteristic letters in any of the string optionarguments
are duplicated or conflict with each other, the ones
given last will take precedence. For example, if -p eme is
specified, file modification times will be preserved.
File names are modified according to the substitution
expression using the syntax of ed(1) as shown:
Any non null character may be used as a delimiter (a / is used
here as an example). Multiple -s expressions may be specified;
the expressions are applied in the order specified terminating
with the first successful substitution. The optional trailing
p causes successful mappings to be listed on standard error.
The optional trailing g causes the old expression to be
replaced each time it occurs in the source string. Files that
substitute to an empty string are ignored both on input and
-t Cause the access times of the archived files to be the same as
they were before being read by pax. -r and standard output for
-u Copy each file only if it is newer than a pre-existing file
with the same name. This implies -a.
-v List file names as they are encountered. Produces a verbose
table of contents listing on the standard output when both -r
and -w are omitted, otherwise the file names are printed to
standard error as they are encountered in the archive.
-x format Specifies the output archive format. The input format, which
must be one of the following, is automatically determined when
the -r option is used. The supported formats are:
cpio The extended CPIO interchange format specified in
Extended CPIO Format in IEEE Std. 1003.1-1988.
ustar The extended TAR interchange format specified in
Extended TAR Format in IEEE Std. 1003.1-1988. This is
the default archive format.
-B bytes Non-standard option on number of bytes written on a single
-D On extraction check file inode change time before the
modification of the file name. Non standard option.
-E limit Non-standard limit on read faults 0 indicates stop after first
error, values indicate a limit, "NONE" try forever
-G group Non-standard option for selecting files within an archive by
group (gid or name)
-H Follow command line symlinks only. Non standard option.
-L Follow symlinks. Non standard option.
-P Do NOT follow symlinks (default).
Non-standard option for selecting files within an archive by
modification time range (lower,upper)
-U user Non-standard option for selecting files within an archive by
user (uid or name).
-X Do not pass over mount points in the file system. Non standard
-Y On extraction check file inode change time after the
modification of the file name. Non standard option.
-Z On extraction check modification time after the modification of
the file name. Non standard option.
When writing to an archive, the standard input is used as a list of
pathnames if no pathname operands are specified. The format is one
pathname per line. Otherwise, the standard input is the archive file,
which is formatted according to one of the specifications in
Archive/Interchange File format in IEEE Std. 1003.1-1988, or some other
The user ID and group ID of the process, together with the appropriate
privileges, affect the ability of pax to restore ownership and
permissions attributes of the archived files. (See format-reading
utility in Archive/Interchange File Format in IEEE Std. 1003.1-1988.)
Operands [Toc] [Back]
The following operands are available:
directory The destination directory pathname for copies when both the -r
and -w options are specified. The directory must exist and be
writable before the copy or and error results.
file A pathname of a file to be copied or archived. When a directory
is named, all of its files and (recursively) subdirectories are
copied as well.
pattern A pattern is given in the standard shell pattern matching
notation. The default if no pattern is specified is *, which
selects all files.
The following command
pax -w -f /dev/rmt0 .
copies the contents of the current directory to tape drive 0.
pax -rw . newdir
copies the contents of olddir to newdir .
pax -r -s ',//*usr//*,,' -f pax.out
reads the archive pax.out with all files rooted in "/usr" in the archive
extracted relative to the current directory.
/dev/tty used to prompt the user for information when the -i option are
cpio(1), find(1), tar(1), cpio(5), tar(5)
Pax will terminate immediately, without processing any additional files
on the command line or in the archive.
Pax will exit with one of the following values:
0 All files in the archive were processed successfully.
>0 Pax aborted due to errors encountered during operation.
Special permissions may be required to copy or extract special files.
Device, user ID, and group ID numbers larger than 65535 cause additional
header records to be output. These records are ignored by some
historical version of cpio(1) and tar(1).
The archive formats described in Archive/Interchange File Format have
certain restrictions that have been carried over from historical usage.
For example, there are restrictions on the length of pathnames stored in
When getting an "ls -l" style listing on tar format archives, link counts
are listed as zero since the ustar archive format does not keep link
On 16 bit architectures, the largest buffer size is 32k-1. This is due,
in part, to using integers in the buffer allocation schemes, however, on
many of these machines, it is not possible to allocate blocks of memory
larger than 32k.
Copyright (c) 1989 Mark H. Colburn.
All rights reserved.
Redistribution and use in source and binary forms are permitted provided
that the above copyright notice is duplicated in all such forms and that
any documentation, advertising materials, and other materials related to
such distribution and use acknowledge that the software was developed by
Mark H. Colburn and sponsored by The USENIX Association.
THE SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Mark H. Colburn
Minnetech Consulting, Inc.
117 Mackubin Street, Suite 1
St. Paul, MN 55102
Sponsored by The USENIX Association for public distribution.
PPPPaaaaggggeeee 8888 [ Back ]