What is pax linux

Linux pax command

Computer Hope

On Unix-like operating systems, the pax command reads and writes the contents of archive files, independent of the archive file format.

This page covers the Linux version of pax.

Description

«Pax» is short for «portable archive interchange.» The software support many major archive formats. It can read the contents of each, and write them to a new, single archive.

Syntax

pax [-c] [-d] [-n] [-v] [-f archive] [-s replstr] [pattern]
pax -r [-c] [-d] [-i] [-k] [-n] [-u] [-v] [-f archive] [ -o options] [-p string] [-s replstr] [pattern]
pax -w [-d] [-i] [-t] [-u] [-v] [-X] [-b blocksize] [-a] i [-f archive] [-o options] [-s replstr] [-x format] [file]
pax -r -w [-d] [-i] [-k] [-l] [-n] [-t] [-u] [-v] [-X] [-p string] [-s replstr] [file] directory
-c Match all file or archive members except those specified by the pattern or file operands.
-d Cause files of type directory being copied or archived or archive members of type directory being extracted to match only the file or archive member itself and not the file hierarchy rooted at the file.
-n Select the first archive member that matches each pattern operand. No more than one archive member is matched for each pattern (although members of type directory still match the file hierarchy rooted at that file).
-v In list mode, produce a verbose table of contents (see standard output). Otherwise, write archive member path names to standard error (see standard error).
-r Read an archive file from standard input.
-i Interactively rename files or archive members. For each archive member matching a pattern operand or file matching a file operand, a prompt is written to the file /dev/tty. The prompt contains the name of the file or archive member. A line is read from /dev/tty. If this line is blank, the file or archive member is skipped. If this line consists of a single period, the file or archive member is processed with no modification to its name. Otherwise, its name is replaced with the contents of the line. The pax command immediately exits with a non-zero exit status if end-of-file is encountered when reading a response or if /dev/tty cannot be opened for reading and writing.
-k Prevent the overwriting of existing files.
-l Link files. In copy mode, hard links are made between the source and destination file hierarchies whenever possible.
-u Ignore files that are older (having a less recent file modification time) than a pre-existing file or archive member with the same name.

where, as in ed, old is a basic regular expression and new can contain an ampersand («&«) or a «\n» backreference, where n is a digit. The old string also is permitted to contain newline characters.

Any non-null character can be used as a delimiter ( «/» is shown here). Multiple -s expressions can be specified; the expressions are applied in the order specified, terminating with the first successful substitution. The optional trailing g is as defined in the ed command. The optional trailing p causes successful substitutions to be written to standard error. File or archive member names that substitute to the empty string are ignored when reading and writing archives.

a Do not preserve file access times.
e Preserve the user ID, group ID, file mode bits, access time, and modification time.
m Do not preserve file modification times.
o Preserve the user ID and group ID.
p Preserve the file mode bits. Other, implementation-dependent file-mode attributes may be preserved.

In the preceding list, «preserve» indicates that an attribute stored in the archive is given to the extracted file, subject to the permissions of the invoking process; otherwise, the attribute is determined as part of the normal file creation action.

If neither the e nor the o specification character is specified, or the user ID and group ID are not preserved for any reason, pax will not set the setuid and setgid bits of the file mode.

If the preservation of any of these items fails for any reason, pax writes a diagnostic message to standard error. Failure to preserve these items affects the final exit status, but will not cause the extracted file to be deleted.

If file-characteristic letters in any of the string option-arguments are duplicated or conflict with each other, the ones given last takes precedence. For example, if -p eme is specified, file modification times is preserved.

Any attempt to append to an archive file in a format different from the existing archive format causes pax to exit immediately with a non-zero exit status.

Examples

Copies the contents of the current directory to tape drive 1, medium density.

chmod — Change the permissions of files or directories.
cpio — Copy files to or from archives.
ed — A simple text editor.
tar — Create, modify, list the contents of, and extract files from tar archives.

Источник

Читайте также:  Clear arp cache linux
Оцените статью
Adblock
detector