Pax (program)
Encyclopedia
pax is an archiving utility created by POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 and defined by the POSIX.1-2001 standard. By default, it creates archives in ustar
USTAR
The Utah Science Technology and Research initiative is a technology-based economic development initiative funded by the state of Utah. The Utah State Legislature passed Senate Bill 75 creating the USTAR initiative in March 2006...

 format, also defined by the POSIX standard. Rather than sort out the incompatible options that have crept up between tar
Tar (file format)
In computing, tar is both a file format and the name of a program used to handle such files...

and cpio
Cpio
cpio is a general file archiver utility and its associated file format. It is primarily installed on Unix-like computer operating systems. The software utility was originally intended as a tape archiving program as part of the Programmer's Workbench , and has been a component of virtually every...

, along with their implementations across various versions of UNIX, the IEEE designed a new archive utility. The name "pax" is an acronym for portable archive exchange. Furthermore, "pax" means "peace" in Latin, so its name implies that it shall create peace between the tar and cpio format supporters. The command invocation and command structure is somewhat a unification of both tar and cpio.

Modes

pax has four general modes which are invoked by a combination of the -r ("read") option and -w ("write") option.

This table summarizes the modal behaviour:
Option Mode Description
(none) "list" shows contents of archive, does not modify or extract anything.
-r "read" reads and extracts contents of an archive
-w "write" creates archives or appends files to an archive
-rw "copy" reads and copies files and directory tree to a specified directory


Examples:

List contents of an archive:
pax < archive.tar

Extract contents of an archive into the current directory:
pax -r < archive.tar

Create an archive of the current directory:

When used in the cpio style, the find command can be used to get a list of files to be archived:
find . -depth -print | pax -wd > archive.tar

Copy current directory tree to another location:

The target directory must exist beforehand!
find . -depth -print | pax -rwd target_dir

Command invocation

pax can be either used in a similar manner as cpio or tar. The cpio syntax takes a list of files from standard input (stdin) when archiving or an already existing archive, when in listing contents or extracting files:
find . -depth -print | pax -wd > archive.tar
and
pax -r < archive.tar
respectively.

It is possible to invoke these commands in a tar-like syntax as well:
pax -wf archive.tar .
and
pax -rf archive.tar

And for clarity and completeness:

Listing files from an archive:
pax -f archive.tar
and "copy" mode:
pax -rw . archive_dir

The -f option specifies which archive to use, instead of writing to stdio or reading from stdin.
Also note the -d option when using pax together with find, this keeps pax from traversing directory trees.

Compression

Most implementations of pax use the -z (gzip
Gzip
Gzip is any of several software applications used for file compression and decompression. The term usually refers to the GNU Project's implementation, "gzip" standing for GNU zip. It is based on the DEFLATE algorithm, which is a combination of Lempel-Ziv and Huffman coding...

) and -j (bzip2
Bzip2
bzip2 is a free and open source implementation of the Burrows–Wheeler algorithm. It is developed and maintained by Julian Seward. Seward made the first public release of bzip2, version 0.15, in July 1996.-Compression efficiency:...

) switches for compression, this feature however, is not specified by POSIX. It is important to note that pax cannot append to compressed archives.

Example for extracting a gziped archive:
pax -rzf archive.tar.gz

Due to the possibility to use pax in a cpio-like fashion, it is possible to use whatever compression program, as an example xz
Xz
xz is a lossless data compression file format incorporating the LZMA2 compression algorithm. Like gzip and bzip2, concatenation is supported to compress multiple files, but the convention is to bundle a file that is an archive itself, such as those created by the tar or cpio Unix...

 is used here:
pax -w . | xz > archive.tar.xz
and listing an xz-compressed archive:
xzcat archive.tar.xz | pax

Format support

As of September 2009, pax supports the following formats, selectable via the -x option:
  • cpio
    Cpio
    cpio is a general file archiver utility and its associated file format. It is primarily installed on Unix-like computer operating systems. The software utility was originally intended as a tape archiving program as part of the Programmer's Workbench , and has been a component of virtually every...

     - 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
    Tar (file format)
    In computing, tar is both a file format and the name of a program used to handle such files...

     - The old BSD tar format as found in BSD4.3.
  • ustar
    USTAR
    The Utah Science Technology and Research initiative is a technology-based economic development initiative funded by the state of Utah. The Utah State Legislature passed Senate Bill 75 creating the USTAR initiative in March 2006...

     (default) - The tar interchange format specified in the IEEE Std 1003.2 ("POSIX.2") standard.

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 medias, 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

Despite being standardized in 2001 by IEEE, as of 2010, pax enjoys relatively little popularity and penetration rate.

pax is required to be present in all conformant systems by Linux Standard Base
Linux Standard Base
The Linux Standard Base is a joint project by several Linux distributions under the organizational structure of the Linux Foundation to standardize the software system structure, including the filesystem hierarchy, used with Linux operating system...

 since version 3.0 (released on July 6, 2005), but so far few Linux distribution
Linux distribution
A Linux distribution is a member of the family of Unix-like operating systems built on top of the Linux kernel. Such distributions are operating systems including a large collection of software applications such as word processors, spreadsheets, media players, and database applications...

s ship and install it by default. However, most distributions include pax as a separately installable package.

Debian popularity contest estimates that, as of 2011, pax is installed on 7.6% of Debian systems that participated in statistics. For comparison, rivalling "tar" archiver has a penetration rate of 99.99%.

Ubuntu popularity contest estimates pax number of installations as 57739 out of 1593595 submissions, that makes even smaller 3.6% penetration rate. "tar" penetration rate in Ubuntu is 1592184 out of 1593595, i.e. 99.91%.

pax has also been present in Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

, where it is limited to file archives (tapes not supported). It was later moved to the Interix
Interix
Interix is the name of an optional, full-featured POSIX and Unix environment subsystem for Microsoft's Windows NT-based operating systems.Interix is a component of the Services for Unix release 3.0 and 3.5...

 subsystem. It does not support archiving or restoring Win32 ACLs.

See also

  • List of Unix utilities
  • List of archive formats
  • Comparison of file archivers
    Comparison of file archivers
    The following tables compare general and technical information for a number of file archivers. Please see the individual products' articles for further information. They are neither all-inclusive nor are some entries necessarily up to date...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK