Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

pax (command)

From Wikipedia, the free encyclopedia
Archiving utility for various operating systems
This articlemay containoriginal research. Pleaseimprove it byverifying the claims made and addinginline citations. Statements consisting only of original research should be removed.(April 2021) (Learn how and when to remove this message)
pax
Original authorMark H. Colburn (sponsored byThe USENIX Association)
DevelopersVariousopen-source andcommercial developers
Initial release1989; 37 years ago (1989)
Written inColburn pax, Muller pax,Heirloom Project pax:C
Operating systemUnix,Unix-like,IBM i,Windows
PlatformCross-platform
TypeCommand
LicenseColburn pax:Prior BSD License
Muller pax:BSD-4-Clause
Heirloom Project pax:zlib
Windows:Proprietary software

pax is anarchiving utility available for variousoperating systems and defined since 1995.[1] Rather than sort out the incompatible options that have crept up betweentar andcpio, along with their implementations across various versions ofUnix, theIEEE designed a new archive utility, pax, that could support various archive formats with useful options from both archivers. Thepaxcommand is available on Unix andUnix-likeoperating systems and onIBM i,[2] andMicrosoftWindows NT[3] untilWindows 2000.

In 2001, IEEE defined a newpax format which is basicallytar with additional extended attributes.[4][5] The format is not supported by pax commands in most Linux distributions and in FreeBSD, but it is supported bytar commands from GNU and FreeBSD; the format is further supported by pax commands in OpenBSD, AIX, Solaris and HP-UX.

The name "pax" is an acronym forportable archive exchange, but is also an allusion to theLatin word for "peace"; the command invocation and structure represents somewhat of a peaceful unification of bothtar andcpio.

History

[edit]

The first public implementation of pax was written by Mark H. Colburn in 1989. Colburn posted it tocomp.sources.unix asUsenix/IEEE POSIX replacement for TAR and CPIO. Manual pages for pax onHP-UX,IRIX, andSCO UNIX attribute pax to Colburn.[6]

As early as POSIX.2 draft 10 from July 1990 coverspax command.[7] Furthermore, POSIX.2 and IEEE 1003.1b drafts in 1991 coverpax command, featuring cpio and ustar archive formats.

Another version of the pax program was created by Keith Muller in 1992–1993.[8] The version first appeared in4.4BSD (1995).[9] Pax command appeared inX/Open issue 4 (Single Unix Specification version 1) in 1995,[1] 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 newpax file format. The POSIX specification for thepax utility was updated to include this format.[1]

Features

[edit]

Modes

[edit]

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:

OptionModeDescription
(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

This model is similar to cpio, which has a similar set of basic operations.

Examples

[edit]

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:

$printf'.'|pax-w>archive.tar$pax-w.>archive.tar

Copy current directory tree to another location:

$printf'.'|pax-w>archive.tar$pax-rwtarget_dir.

The target directory must exist beforehand.

Command invocation

[edit]

By default, pax uses the standard input/output for archive and listing operations. This can be changed with the "tar-style" option-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-d to disable it.

Thepax command is a mish-mash ofcpio andtar features. Liketar,pax processes directory entries recursively, a feature that can be disabled with-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 asshell globs for file input or listing (tar-like); otherwisepax takes thecpio-style behavior of using the standard input for a file list. Finally,pax supports reading/writing to a named archive file using tar's-f FILE option.

For example, if one desires a cpio-style archiving of the current directory,pax can be used withfind just like one does using cpio:

$find.-depth-print|pax-wd>archive.tar

(This construct is pointless without any filters forfind, as it becomes identical to the above example.)

The command for extracting the contents for an archive is the same ascpio:

$pax-r<archive.tar

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

$pax-wfarchive.tar.# write (archive)$pax-rfarchive.tar# read (extract)$pax-farchive.tar# list$pax-rw.archive_dir# copy

Compression

[edit]

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 gzipped archive:

$pax-rzfarchive.tar.gz

As in tar and cpio, pax output can be piped to another compressor/decompressor program. As an examplexz is used here:

$pax-w.|xz>archive.tar.xz

and listing an xz-compressed archive as the input:

$xzcatarchive.tar.xz|pax

Format support

[edit]

POSIX.1-2001 requires thatpax command supports the archive formats cpio, ustar and pax at a minimum.

The versions ofpax command that stem from the 4.4BSD implementation usually inherit the formats supported by that version, 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.

The POSIX.1-2001pax format is not supported by this BSD version ofpax command. The format is not supported on most Linux distributions (whosepax command is from theMirBSD branch ofMirCPIO-paxmirabilis)[10][11][12] and onFreeBSD.[9] The format is supported bypax command in AIX,[13] Solaris[14] and HP-UX. It is further supported by Python tarfile module,[15] by BSD-licensed libarchive,[16][17] by 7-ZIP[18] and further by GNU tar[19] and FreeBSD tar.[20] TheHeirloom Project pax command, developed by Gunnar Ritter in 2003, supports thepax format as well as many extra formats.[21]

Multiple volumes

[edit]

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: 2Load 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

[edit]

Despite being standardized in 2001 by IEEE, as of 2010, pax enjoys relatively little popularity or adoption.[citation needed] 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.[citation needed]

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

pax has also been present inWindows NT, where it is limited to file archives (tapes not supported).[3] It was later moved to theInterix subsystem. It does not support archiving or restoringWin32ACLs.[26] pax was further present in Windows 2000.[27]

Packages handled by theInstaller (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.[28]

See also

[edit]

References

[edit]
  1. ^abcThe Open Group Base Specifications Issue 6Archived 2025-10-23 at theWayback Machine - POSIX.1-2001(IEEE Std 1003.1) Copyright © 2001-2004 The IEEE andThe Open GroupArchived 2025-10-05 at theWayback Machine
  2. ^IBM."IBM System i Version 7.2 Programming Qshell"(PDF).IBM.Archived(PDF) from the original on 2020-09-18. Retrieved2020-09-05.
  3. ^abEric Pearce (1997).Windows NT in a nutshell: a desktop quick reference for system administrators. O'Reilly Media, Inc. p. 271.ISBN 978-1-56592-251-8.
  4. ^"GNU tar: 8.1 Using Less Space through Compression".www.gnu.org. Archived fromthe original on 6 March 2016. Retrieved22 April 2018.
  5. ^"GNU tar: 4.3.2 Extended File Attributes".www.gnu.org. Archived fromthe original on 28 December 2019. Retrieved27 January 2021.
  6. ^TAR versus Portability – PAX and USTARArchived 2021-08-01 at theWayback Machine, invisible-island.net
  7. ^IEEE P1003.2 Draft 11.2−September 1991Archived 2025-09-15 at theWayback Machine (pdf) - Shell and Utilities, princeton.edu - Draft 11 indicates changes topax so it must have been in draft 10
  8. ^paxArchived 2022-07-07 at theWayback Machine, svnweb.freebsd.org
  9. ^abpax(1) – FreeBSD General CommandsManual
  10. ^"MirCPIO — paxmirabilis: tar and even ar!".MirBSD.Archived from the original on 31 January 2020. Retrieved24 January 2020.
  11. ^"MirCPIO in Launchpad".launchpad.net.Archived from the original on 22 April 2018. Retrieved22 April 2018.
  12. ^"Bug #456405 "pax lack of support for "pax" format fails LSB" : Bugs : MirCPIO".bugs.launchpad.net.Archived from the original on 22 April 2018. Retrieved22 April 2018.
  13. ^paxArchived 2022-07-07 at theWayback Machine for AIX 7.3, ibm.com
  14. ^paxArchived 2022-07-08 at theWayback Machine for Solaris 11.1, docs.oracle.com
  15. ^tarfileArchived 2022-07-08 at theWayback Machine, python.org
  16. ^libarchive, libarchive.org
  17. ^libarchive(3)Archived 2022-07-08 at theWayback Machine, freebsd.org
  18. ^HISTORY of the 7-ZipArchived 2018-09-05 at theWayback Machine, 7-zip.org
  19. ^tarArchived 2022-07-08 at theWayback Machine manual, gnu.org
  20. ^tarArchived 2022-04-10 at theWayback Machine, freebsd.org
  21. ^"pax.1".heirloom.sourceforge.net.Archived from the original on 6 May 2018. Retrieved22 April 2018.
  22. ^Release notes for LSB 3.0Archived 2011-07-17 at theWayback Machine note that pax was added:LSB 3.0. Commands and UtilitiesArchived 2016-03-03 at theWayback Machine requires pax, butLSB 2.1.0. Commands and UtilitiesArchived 2016-03-03 at theWayback Machine does not require it
  23. ^pax, pkgs.org
  24. ^spax, pkgs.org
  25. ^heirloom-pax, pkgs.org
  26. ^"System Administration of Backups, Tar, and Pax in Interix". Archived fromthe original on 2010-08-23.
  27. ^Virtual x86Archived 2025-10-09 at theWayback Machine, copy.sh
  28. ^"Extracting files from a pax.gz package". cocoabuilder.com. Archived fromthe original on 14 February 2015. Retrieved15 August 2013.

Further reading

[edit]

External links

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands
The WikibookGuide to Unix has a page on the topic of:Commands
Archivers with
compression
(comparison)
Free and
open-source
Freeware
Commercial
Non-archiving
compressors
Generic
For code
Audio
compression

(comparison)
Lossy
Lossless
Video
compression

(comparison)
Lossy
MPEG-4 ASP
H.264
HEVC
Others
Lossless
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Archiving only
Compressing only
Archiving
and compressing
Software packaging
and distributing
Document packaging
and distributing
Retrieved from "https://en.wikipedia.org/w/index.php?title=Pax_(command)&oldid=1336329004"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp