Modes pax has four general modes that are invoked by a combination of the ("read") and ("write") options. This table summarizes the modal behaviour: This model is similar to cpio, which has a similar set of basic operations.
Examples List contents of an archive: Extract contents of an archive into the current directory: Create an archive of the current directory: Copy current directory tree to another location: The target directory must exist beforehand.
Command invocation By default, pax uses the standard input/output for archive and listing operations. This can be changed with the "tar-style" option that specifies the archive file. Pax differs from cpio by recursively considering the content of a directory; to disable this behavior, POSIX pax has an option to disable it. The command is a mish-mash of and features. Like , processes directory entries recursively, a feature that can be disabled with for cpio-style behavior. The handling of file input/outputs is also a mix: when a list of file names is specified on the command line, they are taken as
shell globs for file input or listing (tar-like); otherwise takes the -style behavior of using the standard input for a file list. Finally, supports reading/writing to a named archive file using tar's option. For example, if one desires a cpio-style archiving of the current directory, can be used with just like one does using cpio: (This construct is pointless without any filters for , as it becomes identical to the above example.) The command for extracting the contents for an archive is the same as : It is possible to invoke these commands in a tar-like syntax as well:
Compression Most implementations of pax use the (
gzip) and (
bzip2) switches for compression; this feature however, is not specified by POSIX. Pax cannot append to compressed archives. Example for extracting a gzipped archive: As in tar and cpio, pax output can be piped to another compressor/decompressor program. As an example
xz is used here: and listing an xz-compressed archive as the input:
Format support POSIX.1-2001 requires that
pax command supports the archive formats cpio, ustar and pax at a minimum. The versions of
pax command that stem from the 4.4BSD implementation usually inherit the formats supported by that version, selectable via the option: •
cpio – The extended cpio interchange format specified in the IEEE Std 1003.2 ("POSIX.2") standard. • bcpio – The old binary cpio format. • sv4cpio – The System V release 4 cpio. • sv4crc – The System V release 4 cpio with file crc checksums. •
tar – The old BSD tar format as found in BSD4.3. •
ustar (default) – The tar interchange format specified in the IEEE Std 1003.2 ("POSIX.2") standard. The POSIX.1-2001
pax format is not supported by this BSD version of
pax command. The format is not supported on most Linux distributions (whose
pax command is from the
MirBSD branch of
MirCPIO-paxmirabilis) and on
FreeBSD. The format is supported by
pax command in AIX, Solaris and HP-UX. It is further supported by Python tarfile module, by BSD-licensed libarchive, by 7-ZIP and further by GNU tar and FreeBSD tar. The
Heirloom Project pax command, developed by Gunnar Ritter in 2003, supports the
pax format as well as many extra formats.
Multiple volumes pax supports archiving on multiple volumes. When the end of a volume is reached, the following message appears: $ pax -wf /dev/fd0 . ATTENTION! pax archive volume change required. /dev/fd0 ready for archive volume: 2 Load the NEXT STORAGE MEDIA (if required) and make sure it is WRITE ENABLED. Type "y" to continue, "." to quit pax, or "s" to switch to new device. If you cannot change storage media, type "s" Is the device ready and online? > When restoring an archive from multiple media, pax asks for the next media in the same fashion, when the end of the media is reached before the end of the archive. == Standardization, reception and popularity ==