Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pax (command)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Archiving utility for various operating systems}} {{Original research|date=April 2021}} {{lowercase|title=pax (Unix)}} {{Infobox software | name = pax | logo = | screenshot size = | caption = The [[Windows NT]] <code>pax</code> command | author = Mark H. Colburn (sponsored by [[The USENIX Association]]) | developer = Various [[open-source software|open-source]] and [[commercial software|commercial]] developers | released = {{Start date and age|1989}} | latest release version = | latest release date = | programming language = Colburn pax, Muller pax, [[Heirloom Project]] pax: [[C (programming language)|C]] | operating system = [[Unix]], [[Unix-like]], [[IBM i]], [[Microsoft Windows|Windows]] | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = Colburn pax: [[Prior BSD License]]<br />Muller pax: [[BSD-4-Clause]]<br />Heirloom Project pax: [[zlib License|zlib]]<br />Windows: [[Proprietary software]] | website = }} '''pax''' is an [[File archiver|archiving utility]] available for various [[operating system]]s and defined since 1995.<ref name=POSIX>[http://pubs.opengroup.org/onlinepubs/009695399/utilities/pax.html The Open Group Base Specifications Issue 6] - POSIX.1-2001 ''(IEEE Std 1003.1)'' Copyright Β© 2001-2004 The IEEE and [http://www.opengroup.org/ The Open Group]</ref> Rather than sort out the incompatible options that have crept up between <code>[[tar (computing)|tar]]</code> and <code>[[cpio]]</code>, along with their implementations across various versions of [[Unix]], the [[IEEE]] designed a new archive utility pax that could support various archive formats with useful options from both archivers. The <code>pax</code> [[command (computing)|command]] is available on Unix and [[Unix-like]] [[operating system]]s and on [[IBM i]],<ref>{{cite web |title=IBM System i Version 7.2 Programming Qshell |language=en |author=IBM |website=[[IBM]] |author-link=IBM |url=https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzahz/rzahzpdf.pdf?view=kc |access-date=2020-09-05 }}</ref> and [[Microsoft]] [[Windows NT]]<ref name="Pearce1997" /> until [[Windows 2000]]. In 2001, IEEE defined a new ''pax'' format which is basically ''tar'' with additional extended attributes.<ref name=gnu_68>{{cite web |url=https://www.gnu.org/software/tar/manual/html_section/tar_68.html |archive-url=https://web.archive.org/web/20160306131119/https://www.gnu.org/software/tar/manual/html_section/tar_68.html |archive-date=6 March 2016 |title=GNU tar: 8.1 Using Less Space through Compression |website=www.gnu.org |access-date=22 April 2018}}</ref><ref name=gnu_33>{{cite web |url=https://www.gnu.org/software/tar/manual/html_section/tar_33.html |archive-url=https://web.archive.org/web/20191228012706/https://www.gnu.org/software/tar/manual/html_section/tar_33.html |archive-date=28 December 2019 |access-date=27 January 2021 |website=www.gnu.org |title=GNU tar: 4.3.2 Extended File Attributes}}</ref> The format is not supported by pax commands in most Linux distributions and in FreeBSD, but it is supported by [[tar (computing)|tar]] commands from GNU and FreeBSD; the format is further supported by pax commands in AIX, Solaris and HP-UX. The name "pax" is an acronym for ''portable archive exchange'', but is also an allusion to the [[Latin]] word for "peace"; the command invocation and structure represents somewhat of a peaceful unification of both <code>tar</code> and <code>cpio</code>. == History == The first public implementation of pax was written by Mark H. Colburn in 1989. Colburn posted it to {{Mono|comp.sources.unix}} as ''Usenix/IEEE POSIX replacement for TAR and CPIO''. Manual pages for pax on [[HP-UX]], [[IRIX]], and [[SCO UNIX]] attribute pax to Colburn.<ref>[https://www.invisible-island.net/autoconf/portability-tar.html#var_pax TAR versus Portability β PAX and USTAR], invisible-island.net</ref> As early as POSIX.2 draft 10 from July 1990 covers ''pax'' command.<ref>[http://mirror.math.princeton.edu/pub/oldlinux/Linux.old/Ref-docs/POSIX/all.pdf IEEE P1003.2 Draft 11.2βSeptember 1991] (pdf) - Shell and Utilities, princeton.edu - Draft 11 indicates changes to ''pax'' so it must have been in draft 10</ref> Furthermore, POSIX.2 and IEEE 1003.1b drafts in 1991 cover ''pax'' command, featuring cpio and ustar archive formats. Another version of the pax program was created by Keith Muller in 1992β1993.<ref>[https://svnweb.freebsd.org/base/head/bin/pax/ pax], svnweb.freebsd.org</ref> The version first appeared in [[4.4BSD]] (1995).<ref name=fbsd/> Pax command appeared in [[X/Open]] issue 4 ([[Single Unix Specification]] version 1) in 1995,<ref name=POSIX/> featuring cpio and ustar archive formats, which were also the only two formats featuring in the 1997 Single Unix Specification. In 1997, [[Sun Microsystems]] proposed a method for adding extensions to the ustar format. This method was accepted for the POSIX.1-2001 standard as the new ''pax'' file format. The POSIX specification for the {{tt|pax}} utility was updated to include this format.<ref name=POSIX/> == Features == === Modes === pax has four general modes that are invoked by a combination of the {{mono|-r}} ("read") and {{mono|-w}} ("write") options. This table summarizes the modal behaviour: {| class="wikitable" |- ! Option ! Mode ! Description |- | ''(none)'' | "list" | shows contents of archive, does not modify or extract anything. |- | {{tt|-r}} | "read" | reads and extracts contents of an archive |- | {{tt|-w}} | "write" | creates archives or appends files to an archive |- | {{tt|-rw}} | "copy" | reads and copies files and directory tree to a specified directory |} This model is similar to cpio, which has a similar set of basic operations. ==== Examples ==== List contents of an archive: {{sxhl|2=console|$ pax < archive.tar}} Extract contents of an archive into the current directory: {{sxhl|2=console|$ pax -r < archive.tar}} Create an archive of the current directory: {{sxhl|2=console| $ printf '.' {{!}} pax -w > archive.tar $ pax -w . > archive.tar }} Copy current directory tree to another location: {{sxhl|2=console| $ printf '.' {{!}} pax -w > archive.tar $ pax -rw target_dir . }} (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 {{code|-f}} 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 {{code|-d}} to disable it. The {{tt|pax}} command is a mish-mash of {{tt|cpio}} and {{tt|tar}} features. Like {{tt|tar}}, {{tt|pax}} processes directory entries recursively, a feature that can be disabled with {{code|-d}} 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 [[Glob (programming)|shell globs]] for file input or listing (tar-like); otherwise {{tt|pax}} takes the {{tt|cpio}}-style behavior of using the standard input for a file list. Finally, {{tt|pax}} supports reading/writing to a named archive file using tar's {{code|-f FILE}} option. For example, if one desires a cpio-style archiving of the current directory, {{tt|pax}} can be used with {{tt|find}} just like one does using cpio: {{sxhl|2=console|$ find . -depth -print {{!}} pax -wd > archive.tar}} (This construct is pointless without any filters for {{tt|find}}, as it becomes identical to the above example.) The command for extracting the contents for an archive is the same as {{tt|cpio}}: {{sxhl|2=console|$ pax -r < archive.tar}} It is possible to invoke these commands in a <code>tar</code>-like syntax as well: {{sxhl|2=console| $ pax -wf archive.tar . # write (archive) $ pax -rf archive.tar # read (extract) $ pax -f archive.tar # list $ pax -rw . archive_dir # copy }} === Compression === Most implementations of pax use the {{tt|-z}} ([[gzip]]) and {{tt|-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.<br /> Example for extracting a gzipped archive: {{sxhl|2=console|$ pax -rzf archive.tar.gz}} As in tar and cpio, pax output can be piped to another compressor/decompressor program. As an example [[XZ Utils|xz]] is used here: {{sxhl|2=console|$ pax -w . {{!}} xz > archive.tar.xz}} and listing an xz-compressed archive as the input: {{sxhl|2=console|$ xzcat archive.tar.xz {{!}} pax}} === 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 {{tt|-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 (file format)|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'')<ref>{{cite web |title=MirCPIO β paxmirabilis: tar and even ar! |url=https://www.mirbsd.org/pax.htm |website=MirBSD |access-date=24 January 2020}}</ref><ref>{{cite web|url=https://launchpad.net/paxmirabilis|title=MirCPIO in Launchpad|website=launchpad.net|access-date=22 April 2018}}</ref><ref>{{cite web|url=https://bugs.launchpad.net/paxmirabilis/+bug/456405|title=Bug #456405 "pax lack of support for "pax" format fails LSB" : Bugs : MirCPIO|website=bugs.launchpad.net|access-date=22 April 2018}}</ref> and on [[FreeBSD]].<ref name=fbsd>{{Man|1|pax|FreeBSD}}</ref> The format is supported by ''pax'' command in AIX,<ref>[https://www.ibm.com/docs/en/aix/7.3?topic=p-pax-command pax] for AIX 7.3, ibm.com</ref> Solaris<ref>[https://docs.oracle.com/cd/E26502_01/html/E29030/pax-1.html#scrolltoc pax] for Solaris 11.1, docs.oracle.com</ref> and HP-UX. It is further supported by Python tarfile module,<ref>[https://docs.python.org/3/library/tarfile.html tarfile], python.org</ref> by BSD-licensed libarchive,<ref>[https://www.libarchive.org/ libarchive], libarchive.org</ref><ref>[https://www.freebsd.org/cgi/man.cgi?query=libarchive&sektion=3 libarchive(3)], freebsd.org</ref> by 7-ZIP<ref>[https://www.7-zip.org/history.txt HISTORY of the 7-Zip], 7-zip.org</ref> and further by GNU tar<ref>[https://www.gnu.org/software/tar/manual/tar.html tar] manual, gnu.org</ref> and FreeBSD tar.<ref>[https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=1 tar], freebsd.org</ref> The [[Heirloom Project]] pax command, developed by Gunnar Ritter in 2003, supports the ''pax'' format as well as many extra formats.<ref name=hl>{{cite web|url=http://heirloom.sourceforge.net/man/pax.1.html|title=pax.1|website=heirloom.sourceforge.net|access-date=22 April 2018}}</ref> === Multiple volumes === pax supports archiving on multiple volumes. When the end of a volume is reached, the following message appears: <syntaxhighlight lang="console"> $ 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? > </syntaxhighlight> 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.{{cn|date=September 2020}} This is in part because there was not any need for it from the Unix users; it was just the POSIX committee that wants to have a more consistent interface. Pax is also fairly chatty and expects user interactions when things go wrong.{{cn|date=September 2020}} pax is required to be present in all conformant systems by [[Linux Standard Base]] since version 3.0 (released on July 6, 2005),<ref>[http://www.linuxfoundation.org/en/ReleaseNotes3#Commands Release notes for LSB 3.0] {{Webarchive|url=https://web.archive.org/web/20110717202848/http://www.linuxfoundation.org/en/ReleaseNotes3#Commands |date=2011-07-17 }} note that pax was added: [http://refspecs.linux-foundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/command.html#CMDUTIL LSB 3.0. Commands and Utilities] requires pax, but [http://refspecs.linux-foundation.org/LSB_2.1.0/LSB-Core-generic/LSB-Core-generic/command.html#CMDUTIL LSB 2.1.0. Commands and Utilities] does not require it</ref> but so far few [[Linux distribution]]s ship and install it by default. However, most distributions include pax as a separately installable package.<ref>[https://pkgs.org/download/pax pax], pkgs.org</ref><ref>[https://pkgs.org/download/spax spax], pkgs.org</ref><ref>[https://pkgs.org/download/heirloom-pax heirloom-pax], pkgs.org</ref> pax has also been present in [[Windows NT]], where it is limited to file archives (tapes not supported).<ref name="Pearce1997">{{cite book|author=Eric Pearce|title=Windows NT in a nutshell: a desktop quick reference for system administrators|url=https://archive.org/details/windowsntinnutsh00pear|url-access=registration|year=1997|publisher=O'Reilly Media, Inc.|isbn=978-1-56592-251-8|page=[https://archive.org/details/windowsntinnutsh00pear/page/271 271]}}</ref> It was later moved to the [[Interix]] subsystem. It does not support archiving or restoring [[Win32]] [[Access-control list|ACL]]s.<ref>{{cite web |url=http://support.microsoft.com/kb/246322 |url-status=dead |archive-url=https://web.archive.org/web/20100823020403/http://support.microsoft.com/kb/246322 |archive-date=2010-08-23 |title=System Administration of Backups, Tar, and Pax in Interix}}</ref> pax was further present in Windows 2000.<ref>[http://copy.sh/v86/ Virtual x86], copy.sh</ref> Packages handled by the [[Installer (macOS)]] often carry the bulk of their contents in an Archive.pax.gz file that may be read using the system's pax (heirloom) utility.<ref>{{cite web|title=Extracting files from a pax.gz package|url=http://www.cocoabuilder.com/archive/cocoa/24947-extracting-files-from-pax-gz-package.html|publisher=cocoabuilder.com|access-date=15 August 2013|archive-url=https://web.archive.org/web/20150214222646/http://www.cocoabuilder.com/archive/cocoa/24947-extracting-files-from-pax-gz-package.html|archive-date=14 February 2015|url-status=dead}}</ref> == See also == * [[List of Unix commands]] * [[List of archive formats]] * [[Comparison of file archivers]] == References == {{Reflist}} ==Further reading== *{{Cite book|first=Γleen|last=Frisch|year=2001|title=Windows 2000 Commands Pocket Reference|publisher=[[O'Reilly Media|O'Reilly]]|isbn=978-0-596-00148-3}} == External links == {{Wikibooks|Guide to Windows Commands}} {{Wikibooks|Guide to Unix|Commands}} * [http://onlamp.com/pub/a/bsd/2002/08/22/FreeBSD_Basics.html Archiving with Pax] {{Webarchive|url=https://web.archive.org/web/20091004201357/http://onlamp.com/pub/a/bsd/2002/08/22/FreeBSD_Basics.html |date=2009-10-04 }} Article in ''FreeBSD basics'' on [http://onlamp.com/ ONLamp.com] {{Webarchive|url=https://web.archive.org/web/20090917110909/http://onlamp.com/ |date=2009-09-17 }}, by [http://onlamp.com/pub/au/73 Dru Lavigne] {{Webarchive|url=https://web.archive.org/web/20081010153810/http://onlamp.com/pub/au/73 |date=2008-10-10 }} ''(2002-08-22)'' * {{man|cu|pax|SUS}} * {{man|1|pax|FreeBSD}} * {{man|1|pax|OpenBSD}} * [https://man7.org/linux/man-pages/man1/pax.1p.html pax.1p] β Linux Manual β POSIX Programmer's Manual, not actual Linux * {{man|1|pax|Debian}} * {{man|1|pax|Solaris}} * [https://github.com/openbsd/src/tree/master/bin/pax Source code] {{Compression software}} {{Unix commands}} {{Windows commands}} {{Archive formats}} [[Category:File archivers]] [[Category:Unix archivers and compression-related utilities]] [[Category:Unix SUS2008 utilities]] [[Category:IBM i Qshell commands]] [[Category:1995 software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Ambox
(
edit
)
Template:Archive formats
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Cn
(
edit
)
Template:Code
(
edit
)
Template:Compression software
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Mono
(
edit
)
Template:Original research
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Sxhl
(
edit
)
Template:Template other
(
edit
)
Template:Tt
(
edit
)
Template:Unix commands
(
edit
)
Template:Webarchive
(
edit
)
Template:Wikibooks
(
edit
)
Template:Windows commands
(
edit
)