*** Welcome to piglix ***

Pax (Unix)


pax is an archiving utility created by POSIX and defined by the POSIX.1-2001 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 that could support various archive formats, including a new format which is basically tar with additional extended attributes. The name "pax" is an acronym for portable archive exchange. The command invocation and structure is somewhat a unification of both tar and cpio.

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:

Examples:
List contents of an archive:

Extract contents of an archive into the current directory:

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:

Copy current directory tree to another location:
The target directory must exist beforehand!

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:

and

respectively.

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

and

And for clarity and completeness:
Listing files from an archive:

and "copy" mode:

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:


...
Wikipedia

...