portable archive exchange
pax [ -cdimnuvy ] [ -f
archive ] [ -s replstr ] ...
[ pattern ... ]
pax -r [ -cdikmnTuvy ] [ -f
archive ] [ -o options ] ...
[ -p string ] ... [ -s
replstr ] ... [ pattern ... ]
pax -w [ -diLmtuvXy ] [ -b
blocking ] [ [ -a ] [ -f
archive ] ] [ -o options ] ... [
-s replstr ] ... [ -x
format ] [ pathname ... ]
pax -rw [ -idklLmntuvXy ] [ -p
string ] ... [ -s
replstr ] ... [ pathname ... ]
The pax command 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
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
The command line arguments are:
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
pax reads an archive file from the standard input. Only
files with names that match any of the pattern operands
are selected for extraction. 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 invoking process, and the
permissions and modification times will be the same as those in the
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
Writes the files and directories specified by pathname
operands to the standard output together with the pathname and
status information prescribed by the archive format used. A
directory pathname operand refers to the files and
(recursively) subdirectories of that directory. If no
pathname operands 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
pax reads the files and directories named in the
pathname operands and copies them to the destination
directory. A directory pathname operand refers
to the files and (recursively) subdirectories of that directory. If
no pathname operands are given, 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. The directory named by the directory operand must
exist and have the proper permissions before the copy can occur.
pathname == linkname
and symbolic link pathnames (if supported by the filesystem) 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 lists
normal pathnames in the same format used by the ls utility
with the -l option. Hard links are shown as
<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 volume.
The following options are available:
pax resolves conflicts between file characteristics set by
these letters by giving precedence to later letters in the string.
The files specified by pathname are appended to the
Block the output at blocking bytes per write to the
archive file. A k suffix multiplies blocking by
1024, a b suffix multiplies blocking by 512 and
an m suffix multiplies blocking by 1048576 (1
megabyte). If not specified, blocking is automatically
determined on input and is ignored for -rw.
Complement the match sense of the pattern operands.
Intermediate directories not explicitly listed in the archive are
The -f archive option specifies the pathname of
the input or output archive, overriding the default of standard
input for -r or standard output for -w. Only
the last of multiple -f options takes effect.
Interactively rename files. Substitutions specified by -s
options (described below) are performed before requesting the new
filename from the user. A file is skipped if an empty line is
entered and pax exits with an exit status of 0 if
EOF is encountered.
Prevent the overwriting of existing files.
When specified with the -rw option,
link files rather than copy them.
Follow symbolic links.
File modification times are not retained.
Read the first occurrence of the file in the input archive that
Provide options for the archive format specified by the
Specify a string representing characteristics for a file
being extracted from an archive. The string is constructed
by concatenating any of the following characters:
Do not retain file access times.
Retain all file characteristics (access and modification times, user
and group IDs, and file-mode bits).
Do not retain file modification times.
Retain user and group IDs.
Retain the file-mode bits.
Filenames are modified according to the substitution expression
using the syntax of
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 output.
Set the access times of the archived files to be the same as
before pax read them.
Truncate long filenames to 14 characters when restoring an
archive. This feature is for compatibility with XENIX and
AFS filesystems which do not support long filenames. This
option is not used with the -w option.
Copy each file only if it is newer than a pre-existing file with the
same name. This implies -a.
List filenames as they are encountered. Produces a verbose table of
contents listing on the standard output when both -r and
-w are omitted; otherwise, the filenames are printed to
the standard error.
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:
The default blocksize for the supported formats is 512 bytes;
blocksizes are supported in 512-byte multiples up to 32 kilobytes.
The extended cpio interchange format specified in
``Extended CPIO Format'' in IEEE
The extended tar interchange format specified in
``Extended TAR Format'' in IEEE
Std. 1003.1-1988. This is the default archive format.
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
Prevent examination of directories in another filesystem mounted in
the directory hierarchy below pathname.
Interactively prompt for the disposition of each file. Substitutions
specified by -s options (described above) are performed
before prompting the user for disposition. EOF or an input
line starting with the character q caused pax to
exit. Otherwise, an input line starting with anything other than
y causes the file to be ignored. This option cannot be
used in conjunction with the -i option.
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
The options -a, -c, -d,
-i, -l, -u, and -y are
provided for functional compatibility with the historical
cpio and tar utilities. The option defaults were
chosen based on the most common usage of these options, therefore,
some of the options have meanings different than those of the
The following operands are available:
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 error results.
A file whose contents are used instead of the files named on the
standard input. When a directory is named, all of its files and
(recursively) subdirectories are copied as well.
A pattern is given in the standard shell pattern matching
notation. The default if no pattern is specified is
``''\, which selects all files.
pax will terminate immediately on an error, without
processing any additional files on the command line or in the
pax will exit with one of the following values:
All files in the archive were processed successfully.
pax aborted due to errors encountered during operation.
The command pax -w -f /dev/rmt0 . copies the contents
of the current directory to tape drive 0. (Note that this example
assumes that a 1600 bpi 9 track tape device is installed.)
The following commands copy the contents of olddir to
pax -rw . newdir
The command 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
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 and
The archive formats have certain restrictions that have been carried
over from historical usage. For example, there are restrictions on
the length of pathnames stored in the archive.
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 count information.
Root user permissions may be required to copy or extract
used to prompt the user for information when the -i or
-y options are specified
Copyright © 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
THE SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
Mark H. Colburn
117 Mackubin Street, Suite 1
St. Paul, MN 55102
Sponsored by The USENIX Association for public
pax is conformant with:
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
A version of pax
that can handle files greater than 2GB
is available in /u95/bin. See
for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005