Portable archive interchange (POSIX)
List archive contents:
pax [-cimopuvy] [-f archive] [-s replstr]... [-t device] [pattern...]
Read an archive:
pax -r [-cimnopuvy] [-f archive] [-s replstr]... [-t device] [pattern...]
Write an archive:
pax -w [-dimuvy] [-b blocking] [-[a]f archive] [-s replstr]... [-t device] [-x format] [pathname...]
Copy files:
pax -rw [-ilmopuvy] [-s replstr]... [pathname...] directory
QNX Neutrino, Microsoft Windows
-s /old/new/[gp]
You can use any non-null character as a delimiter (a / is used here as an example). Multiple -s 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. If a filename becomes an empty string after applying substitutions to it, it's ignored both on input and output.
Only the last -f or -t option takes effect. |
If you don't specify -r or -w, then pax lists the contents of the specified archive. In this mode, pax lists normal files one per line. Hard link pathnames are listed as:
pathname == linkname
where pathname is the name of the file being extracted, and linkname is the name of a file that appeared earlier in the archive.
Symbolic link pathnames are listed as:
pathname -> destination_path
If you specify -v, then pax lists normal pathnames in the same format used by the ls utility with the -l (“el”) option, except for hard links, which are shown as:
<ls -l listing> == linkname
The modes of operation related to combinations of -r and -w are as follows:
The supported archive formats are automatically detected on input.
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 copied.
The pax utility reads and writes archive files that conform to the archive/interchange file format specified in POSIX Std 1003.1-1988. The utility can also read, but not write, a number of other file formats. 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.
The pax utility also supports traditional cpio and System V tar interfaces if invoked with those names (they're links to pax).
The pax utility is capable of reading and writing archives that span multiple physical volumes. Upon detecting an end of medium on an archive that isn't yet completed, pax prompts you for the next volume of the archive and lets you specify the location of the next volume.
If the pax archive is stored directly in a floppy disk block special file (e.g. /dev/fd0), the archive overwrites the first block of the disk, which the floppy driver, devb-fdc, uses to store media-type information that lets it dynamically adjust to diskettes of differing media capacity being inserted in the drive (e.g. 720k vs 1.4M, 360k vs 1.2M etc.). If the floppy driver can't determine the capacity, it assumes 1.4M. |
Combinations of the -r and -w command-line arguments specify whether pax reads, writes, or lists the contents of the specified archive, or moves the specified files to another directory.
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. When reading, the standard input is the archive file, which is formatted according to one of the format specifications in POSIX Std 1003.1-1988.
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 Archive/Interchange File Format in POSIX Std 1003.1-1988.)
Note that the options -a, -c, -d, -i, -l, -p, -t, 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, so some of the options have meanings different from those of the historical commands.
Copy the contents of the current directory to the floppy drive:
pax -w -f /dev/fd0 .
Copy the contents of olddir to newdir:
mkdir newdir cd olddir pax -rw . ../newdir
Read the archive pax.out with all files rooted in /usr in the archive extracted relative to the current directory (note the use of commas as pattern separators for the -s option):
pax -r -s ",^/usr/,," -f pax.out
The controlling terminal (/dev/tty) is used to prompt the user for information when the -i or -y options are specified.
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 versions of cpio and tar.
The archive formats described in Archive/Interchange File Format have certain restrictions that have been carried over from historical usage. For example, pathnames stored in the archive can be no more than 255 characters in length.
When getting an ls -l style listing on tar format archives, link counts are listed as zero since the ustar archive format doesn't keep link count information.
On 16-bit architectures, including 16-bit versions of QNX 4., the largest buffer size is 32K-1. This is due, in part, to using integers in the buffer allocation schemes. On many of these machines, however, it isn't possible to allocate blocks of memory larger than 32K.
bzip2, cp, cpio, find, gzip, tar
Backing Up and Recovering Data in the Neutrino User's Guide