LinuxCommandLibrary

paxs

Extract and create archive files

TLDR

Search for a package

$ paxs [search_term]
copy

Upgrade all packages
$ paxs [[-u|--upgrade-all]]
copy

Install a package (prompting for the source)
$ paxs [[-i|--install]] [package]
copy

Remove a package (prompting for the source)
$ paxs [[-r|--remove]] [package]
copy

Check for updates across all package managers
$ paxs [[-c|--check-update]]
copy

Display help
$ paxs [[-h|--help]]
copy

SYNOPSIS


List Archive Contents:
pax [ options ] [ pattern ... ]
Extract Files from Archive:
pax -r [ options ] [ pattern ... ]
Create New Archive:
pax -w [ options ] [ pathname ... ]
Copy Files and Directories:
pax -rw [ options ] [ pathname ... ]

PARAMETERS

-r
    Reads files from the archive. This activates the 'extract' mode.

-w
    Writes files to an archive. This activates the 'create' mode.

-rw
    Reads and writes files, enabling 'copy' mode. Files are copied from the source pathnames to the destination pathnames.

-f archive
    Specifies the path to the archive file. If omitted, pax reads from standard input or writes to standard output.

-v
    Verbose output. Displays a list of pathnames processed and additional information.

-x format
    Specifies the output archive format. Common formats include cpio, tar, ustar, and pax. Default varies by system.

-s replstr
    Modifies filenames using a regular expression substitution string, similar to the 's' command in sed. Example: -s '/old/new/'.

-p string
    Preserves file properties during extraction or copying. Common values include 'a' (all attributes), 'm' (modification times), 'o' (ownership), 'p' (permissions). Multiple values can be combined, e.g., -p amp.

-L
    Follows symbolic links. If a symbolic link is encountered, pax archives or copies the file pointed to by the link, rather than the link itself.

-d
    Creates intermediate directories for extracted files if they do not already exist.

-k
    Prevents overwriting existing files when extracting from an archive.

-n
    Selects the first archive member that matches each pattern parameter. No more than one archive member is matched for each pattern.

DESCRIPTION


pax (Portable Archive eXchange) is a versatile command-line utility specified by POSIX, designed for creating, reading, and writing archive files. It aims to unify the functionalities of both the traditional tar and cpio commands, providing a single, consistent interface for archive operations.

With pax, users can list the contents of an archive, extract files from an archive, create new archives, or even copy files and directory hierarchies directly from one location to another, much like cp or cpio. It supports various archive formats, including its own pax format, as well as ustar (a common tar variant) and cpio. This multi-format support enhances its portability and interoperability across different Unix-like systems.

Its strength lies in its standardization and ability to handle different archive types, making it a robust choice for managing file backups and transfers in a portable manner.

CAVEATS

While pax offers powerful and standardized archiving capabilities, its extensive options and multiple operational modes can make its usage complex for beginners. Interoperability with non-standard tar or cpio extensions might occasionally lead to minor discrepancies. Users should always verify the behavior for specific archive formats and desired preservation of extended file attributes.

ARCHIVE FORMATS (<B>-X</B> OPTION)

The -x option allows specifying the output archive format. Key formats supported by pax typically include:

cpio: The traditional cpio format.
tar: The traditional tar format, often limited in features compared to ustar.
ustar: The POSIX.1-1988 standard version of the tar format, supporting longer pathnames and user/group names. This is often the default or preferred tar variant for portability.
pax: The POSIX.1-2001 standard format, which extends ustar to support arbitrary metadata (e.g., extended attributes, sparse files) through extended headers. This is the most flexible format.

PRESERVING FILE ATTRIBUTES (<B>-P</B> OPTION)

The -p option is crucial for controlling which file attributes are preserved during extraction or copying. It accepts a string composed of single-character flags:

a: Preserves all attributes, equivalent to -p 'elmop'.
e: Preserves additional extended attributes, if supported by the system.
l: Preserves file access times.
m: Preserves file modification times.
o: Preserves user and group ownership. Requires appropriate privileges.
p: Preserves file permissions (mode bits).

HISTORY

The pax command was standardized by POSIX.1-2001, aiming to provide a unified and portable archiving utility that merges the functionalities of both tar and cpio. Its development addressed the inconsistencies and portability challenges faced when using separate tar and cpio implementations across different Unix-like systems. It has since become a widely available and robust archiving tool on POSIX-compliant operating systems, including most modern Linux distributions.

SEE ALSO

tar(1), cpio(1), gzip(1), bzip2(1), find(1)

Copied to clipboard