pax (Unix)

from Wikipedia, the free encyclopedia

pax is a command under Unix - operating systems for file archiving . The command sees itself as the successor to tar and cpio and works with a large number of different tar and cpio archive data formats , hence the name stands pax for p ortable a rchive e x change , but also in reference to the Latin word for " Peace ”, because the program is supposed to create peace between the two rival commandos tar and cpio . By default, pax uses the ustar file format, which is also defined in POSIX, but the command structure is more similar to cpio.

The program is described by POSIX .1-2001 or The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition .

Functionality and example calls

pax has four basic functions, which have the options -w ("write mode", creating an archive), -r ("read mode", extracting from an archive) and -r -w ("copy mode", Copying directory trees). If no option is specified, pax uses the "list mode" and displays the archive content. pax basically works like other Unix filters , ie it expects its arguments from the input data stream and sends its results to the output data stream .

Create an archive file of the directory ./tmp:

find ./tmp -depth -print | pax -wd -f test.pax 

Unpack the archive file test.pax in the current directory:

pax -r -f test.pax 

View the files and directories contained in an archive file:

pax -f test.pax 

Copy the files and directories of the current directory to the / path / directory:

find . -depth -print | pax -r -w /pfad/verzeichnis

The use of the -depth parameter for find (forcing directory contents to be listed before the directory name) can on the one hand cause the time stamps of directories to be adopted even if the pax implementation is of poor quality , but on the other hand it harbors the risk of files can no longer be copied into read-only directories.

See also

Web links