World Library  
Flag as Inappropriate
Email this Article

Pax (Unix)

Article Id: WHEBN0000723844
Reproduction Date:

Title: Pax (Unix)  
Author: World Heritage Encyclopedia
Language: English
Subject: Ingex, Pax, Whereis, Apropos (Unix), History (Unix)
Collection: File Archivers, Unix Archivers and Compression-Related Utilities, Unix Sus2008 Utilities
Publisher: World Heritage Encyclopedia

Pax (Unix)

pax is an archiving utility created by POSIX and defined by the POSIX.1-2001[1] standard. Rather than sort out the incompatible options that have crept up between tar and cpio, 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. The command invocation and structure is somewhat a unification of both tar and cpio.


  • Features 1
    • Modes 1.1
    • Command invocation 1.2
    • Compression 1.3
    • Format support 1.4
    • Multiple volumes 1.5
  • Standardization, reception and popularity 2
  • See also 3
  • Notes 4
  • External links 5



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

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

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


pax -r < archive.tar


It is possible to invoke these commands in a tar-like syntax as well:

pax -wf archive.tar .


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 stdout or reading from stdin. Also note the -d option when using pax together with find, this keeps pax from traversing directory trees.


Most implementations of pax use the -z (gzip) and -j (bzip2) 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 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, the version of pax included with most Linux distributions (a derivative of an old MirBSD pax[2]) supports the following formats, selectable via the -x 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.

Notably the pax format itself is not supported by this version of pax.[3] Other implementations, such as Heirloom pax, support further formats,[4] including the pax file format.

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

Despite being standardized in 2001 by IEEE, as of 2010, pax enjoys relatively little popularity or adoption.

pax is required to be present in all conformant systems by Linux Standard Base since version 3.0 (released on July 6, 2005),[5] but so far few Linux distributions ship and install it by default. However, most distributions include pax as a separately installable package.

pax has also been present in Windows NT, where it is limited to file archives (tapes not supported).[6] It was later moved to the Interix subsystem. It does not support archiving or restoring Win32 ACLs.[7]

Packages handled by the Installer (OS X) often carry the bulk of their contents in an Archive.pax.gz file that may be read using the pax utility.[8]

See also


  1. ^ The Open Group Base Specifications Issue 6 - POSIX.1-2001 (IEEE Std 1003.1) Copyright © 2001-2004 The IEEE and The Open Group
  2. ^ Launchpad page for pax
  3. ^ Launchpad - pax lacks of support for "pax" format, fails LSB
  4. ^ Heirloom pax man page
  5. ^ Release notes for LSB 3.0 note that pax was added: LSB 3.0. Commands and Utilities requires pax, but LSB 2.1.0. Commands and Utilities does not require it
  6. ^ Eric Pearce (1997). Windows NT in a nutshell: a desktop quick reference for system administrators. O'Reilly Media, Inc. p. 271.  
  7. ^
  8. ^ "Extracting files from a pax.gz package". Retrieved 15 August 2013. 

External links

  • Archiving with Pax Article in FreeBSD basics on, by Dru Lavigne (2002-08-22)
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.