pax Command

Purpose

Extracts, writes, and lists members of archive files; copies files and directory hierarchies.

Syntax

To List Member Files of Archived Files

pax-c  | -n ] [  -d ] [ -U ] [  -v ] [  -H |   -L ] [  -f  Archive ] [  -s ReplacementString ... ] [  -x Format ] [  -o Options ] [ -Z ]Pattern ... ]

To Extract Archive Files Using the -r Flag

pax -r-c  | -n ] [  -d ] [  -i ] [  -k ] [ -U ] [  -u ] [  -v ] [  -H |  -L ] [  -f Archive ] [  -o Options ] [  -p String ... ] [  -s ReplacementString ... ] [  -x Format ] [ -Z ]  [ Pattern ... ]

To Write Archive Files Using the -w Flag

pax -w-d ] [  -i ] [  -t ] [ -U ] [  -u ] [  -v ] [  -X ] [  -H |   -L ] [ -E ] [  -b Blocking ] [ [  -a ]   -f Archive ] [  -o Options ] [  -s ReplacementString ... ] [  -x Format ] [ -Z ]File ... ]

To Copy Files Using the -r and -w Flags

pax -r -w-d ] [  -i ] [  -k ] [  -l ] [  -t ] [ -U ] [  -u ] [  -v ] [  -X ] [  -H |   -L ] [  -p String ... ] [  -o Options ] [  -s ReplacementString ... ] [  -x Format ] [ -Z ]File ... ] Directory

Description

The pax command extracts and writes member files of archive files; writes lists of the member files of archives; and copies directory hierarchies. The -r and -w flags specify the type of archive operation.
Note: pax actively sparses files that are being restored. If a file has block aligned and sized areas that are NULL populated, pax does not cause physical space for those filesystem blocks to be allocated. The size in bytes of the file remains the same, but the actual space taken within the filesystem is only for the non-NULL areas.

Listing Member Files of Archived Files (List Mode)

When neither the -r nor the -w flags are specified, the pax command lists all the member files of the archive file read from standard input. If the Pattern parameter is specified, only the member files with pathnames that match the specified patterns are written to standard output. If a named file is a directory, the file hierarchy contained in the directory is also written. When neither the -r or -w flags are specified, the -c, -d, -f, -n, -s, and -v flags, and the Pattern parameter may be specified.

Extracting Archive Files Using the -r Flag (Read Mode)

When the -r flag is specified, but the -w flag is not, the pax command extracts all the member files of the archive files read from standard input. If the Pattern parameter is specified, only the member files with pathnames that match the specified patterns are written to standard output. If a named file is a directory, the file hierarchy contained in the directory is also extracted. The -r flag can be specified with the -c, -d, -f, -i, -k, -n, -s, -u, and -v flags, and with the Pattern parameter.

The access and modification times of the extracted files are the same as the archived files. The file modes of the extracted files are the same as when they were archived, unless they are affected by the user's default file creation mode (umask). The S_ISUID and S_ISGID bits of the extracted files are cleared.

If intermediate directories are necessary to extract an archive member, the pax command creates the directories with access permissions set as the bitwise inclusive OR of the values of the S_IRWXU, S_IRWXG, and S_IRWXO masks.

If the selected archive format supports the specification of linked files, it is an error if these files cannot be linked when the archive is extracted.

Writing Archive Files Using the -w Flag (Write Mode)

When the -w flag is specified and the -r flag is not, the pax command writes the contents of the files specified by the File parameter to standard output in an archive format. If no File parameter is specified, a list of files to copy, one per line, is read from the standard input. When the File parameter specifies a directory, all of the files contained in the directory are written. The -w flag can be specified with the -a, -b, -d, -f, -i, -o, -s, -t, -u, -v, -x, and -X flags and with File parameters.

When specifying pathnames that are greater than 100 characters for the United States Tape Archiver (USTAR) format, remember that the pathname is composed of a prefix buffer, a / (slash), and a name buffer. The prefix buffer can be a maximum of 155 characters and the name buffer can hold a maximum of 100 characters. If the pathname cannot be split into these two parts by a slash, it cannot be archived. This limitation is due to the structure of tar archive headers, and must be maintained for compliance with standards and backwards compatibility.

Copying Files Using the -r and -w Flags (Copy Mode)

When both the -r and -w flags are specified, the pax command copies the files specified by the File parameters to the destination directory specified by the Directory parameter. If no files are specified, a list of files to copy, one per line, is read from the standard input. If a specified file is a directory, the file hierarchy contained in the directory is also copied. The -r and -w flags can be specified with the -d, -i, -k, -l, -o, -p, -s, -t, -u, -v, and -X flags and with File parameters. The Directory parameter must be specified.

Copied files are the same as if they were written to an archive file and subsequently extracted, except that there may be hard links between the original and the copied files.

Modifying the Archive Algorithm Using the -o Flag

Use the -o flag to modify the archive algorithm according to keyword-value pairs. The keyword-value pairs must adhere to a correct archive format. A list of valid keywords and their behavior is given in the subsequent description of the -o flag.

Further Notes

In read or copy modes, if intermediate directories are necessary to extract an archive member, pax performs actions equivalent to the mkdir() subroutine with the intermediate directory used as the path argument and the value S_IRWXU as the mode argument.

If any specified pattern or file operands are not matched by at least one file or archive member, pax writes a diagnostic message to standard error for each one that did not match and exits with an error status.

In traversing directories, pax will detect infinite loops; i.e., entering a previously visited directory that is an ancestor of the last file visited. Upon detection of an infinite loop, pax writes a diagnostic message to standard error and terminates.

When pax is in read mode or list mode, using the -x pax archive format, and a file name, link name, owner name, or any other field in an extended header record cannot be translated from the pax UTF8 codeset format to the current codeset and locale, pax writes a diagnostic message to standard error, processes the file as described for the -o invalid= option, and then processes the next file in the archive.

For AIX® 5.3, the pax command will ignore extended attributes by default. The -U option informs pax to archive or restore extended attributes, which includes ACLs. The -pe option will preserve ACLs. When the -pe option is specified if pax fails to preserve the ACLs a diagnostic message shall be written to standard error, but the extracted file will not be deleted. A non-zero exit code will be returned. A new record type is required for extended attribute entries in pax archive files.

Variables

Item Description
Directory Specifies the path of a destination directory when copying files.
File Specifies the path of a file to be copied or archived. If no file matches the File parameter, the pax command detects the error, exits, and writes a diagnostic message.
Pattern Specifies a pattern that matches one or more paths of archive members. A / (backslash) character is not recognized in the Pattern parameter and it prevents the subsequent character from having any special meaning. If no Pattern parameter is specified, all members are selected in the archive.

If a Pattern parameter is specified, but no archive members are found that match the pattern specified, the pax command detects the error, exits, and writes a diagnostic message.

Flags

Item Description
-a Appends files to the end of an archive.
Note: Streaming tape devices do not allow append.
-b Blocking Specifies the block size for output. The Blocking parameter specifies a positive decimal integer value that specifies the number of bytes per block. Application conforming to POSIX2 should not specify a blocksize value greater than 32256. Devices and archive formats may impose restrictions on blocking. Blocking is automatically determined on input. Default blocking when creating archives depends on the archive format. (See the -x flag definition.)

The value of the Blocking parameter may be one of the following:

Integer b
Specifies that the block size, in bytes, be the value of the positive decimal integer specified by the Integer parameter multiplied by 512.
Integer k
Specifies that the block size, in bytes, be the value of the positive decimal integer specified by the Integer parameter multiplied by 1024.
Integer m
Specifies that the block size, in bytes, be the value of the positive decimal integer specified by the Integer parameter multiplied by 1024 x 1024.
Integer+Integer
Specifies that the block size, in bytes, be the sum of the positive decimal integers specified by the Integer parameters.
-c Matches all file or archive members except those specified by the Pattern parameter.
-d Causes directories being copied, archived, or extracted, to match only the directory itself and not the contents of the directory.
-E Avoids truncation of the long user and group names during addition of files to new/existing archive.
-f Archive Specifies the path of an archive file to be used instead of standard input (when the -w flag is not specified) or standard output (when the -w flag is specified but the -r flag is not). When specified with the -a flag option, any files written to the archive are appended to the end of the archive.
-H If a symbolic link referencing a directory is specified on the command line, pax archives the file hierarchy rooted in the directory referenced in the link, using the name of the link as the name of the file hierarchy. By default, pax archives the symbolic link itself.
-i Renames files or archives interactively. For each archive member that matches the Pattern parameter or file that matches a File parameter, a prompt is written to the display device that contains the name of a file or archive member. A line is then read from the display device. If this line is empty, 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.
-k Prevents the pax command from writing over existing files.
-l Links files when copying files. Hard links are established between the source and destination file hierarchies whenever possible.
-L If a symbolic link referencing a directory is specified on the command line or encountered during the traversal of a file hierarchy, pax archives the file hierarchy rooted in the directory referenced in the link, using the name of the link as the name of the file hierarchy. By default, pax archives the symbolic link itself.
-n Selects the first archive member that matches each Pattern parameter. No more than one archive member is matched for each pattern.
-o Options Modifies the archiving algorithm according to the keyword-value pairs specified in the Options parameter. The keyword-value pairs must be in the following format:

keyword:=value,keyword:=value,...

Some keywords apply only to certain file formats, as indicated with each description. Use of keywords that are inapplicable to the file format being processed will be ignored by pax.

Keywords can be preceded with white space. The value field consists of zero or more characters; within value, any literal comma must be preceded with a backslash (\). A comma as the final character, or a comma followed solely by white space as the final character, in Options will be ignored. Multiple -o options can be specified. If keywords given to these multiple -o options conflict, the keywords and values appearing later in command-line sequences take precedence; earlier values are ignored.

The following keyword-value pairs are supported for the indicated file formats:

datastream=pathname,datastr_size=size (Applicable to all file formats.)

The datastream keyword indicates the incoming archive file is not in a file format; instead, it is a data stream from the standard input device. Consequently, the data should be archived as a regular file in a format recognized by the -x flag. The file name of the data stream should be specified in the pathname parameter and should include the identification of the person who invoked the command, the group identification, and the umask for the file mode.

Note: The datastream keyword does not have a default variable size. You must specify one.

The datastr_size keyword denotes the size of the data stream input in bytes using decimal digits. If the pax command reaches the end of file (EOF) character before it reads the size parameter, it pads the archive file with null values. The null values make the archive file the same size as specified by the size parameter. If the data in the archive file exceeds the size specified, the pax command truncates the archive file to the size specified by the size parameter. The pax command also stops taking input and closes the archive file.

Note: You can specify multiple instances of keyword pairs. If you assign different values to the same keyword, the pax command uses the last value assigned to the keyword to execute the -o flag.

delete=pattern (Applicable only to the -x pax format.)

When used in write or copy mode, pax omits any keywords matching pattern from the extended header records that it produces. When used in read or list mode, pax ignores any keywords matching pattern in the extended header records. In all cases, matching is done using standard shell pattern-matching notation. For example, -o delete=security.* suppresses security-related information.

Item Description
-o Options (Continued)

 

exthdr.name=string (Applicable only to the -x pax format.)

This keyword allows user control over the name written into the ustar header blocks for the extended header records. The name is the contents of string after the following character substitutions have been made:

string includes:
Replaced by:
%d
The directory name of the file, equivalent to the result of the dirname utility on the translated pathname
%f
The filename of the file, equivalent to the result of the basename utility on the translated pathname
%%
A %% character

Any other % characters in string produce undefined results. If this keyword-value pair is not specified in the -o Options list, the default value of the name is:

%d/PaxHeaders/%f

globexthdr.name=string (Applicable only to the -x pax format.)

When used in write or copy mode with the appropriate options, pax creates global extended header records with ustar header blocks that will be treated as regular files by previous versions of pax. This keyword allows user control over the name that is written into the ustar header blocks for global extended header records. The name is the contents of string after the following character substitutions have been made:

string includes:
Replaced by:
%n
An integer that represents the sequence number of the global extended header record in the archive starting at 1
%%
A % character

Any other % characters in string produce undefined results. If this keyword-value pair is not specified in the -o Options list, the default value of the name is

$TMPDIR/GlobalHead.%n

where $TMPDIR is either the value of the TMPDIR environment variable or /tmp if TMPDIR is unset.

invalid=action (Applicable only to the -x pax format.)

This keyword allows user control over the action pax takes upon encountering values in an extended header record that:

  • in read or copy mode, are invalid in the destination hierarchy, or
  • in list mode, cannot be written in the codeset and current locale.
Item Description
-o Options (Continued)

pax recognizes these invalid values:

  • In read or copy mode, a filename or link name that contains character encodings invalid in the destination hierarchy. (For example, the name may contain embedded NULLs.)
  • In read or copy mode, a filename or link name that is longer than the maximum allowed in the destination hierarchy (for either a pathname component or the entire pathname).
  • In list mode, any character string value (filename, link name, user name, etc.) that cannot be written in the codeset and current locale.

These mutually exclusive values of the action argument are supported:

  • bypass

    In read or copy mode, pax bypasses the file, causing no change to the destination hierarchy. In list mode, pax writes all requested valid values for the file, but its method for writing invalid values is unspecified.

  • rename

    In read or copy mode, pax acts as if the -i flag is in effect for each file with invalid filename or link name values, allowing the user to provide a replacement name interactively. In list mode, pax behaves identically to the bypass action.

  • UTF8

    When used in read, copy, or list mode and a filename, link name, owner name, or any other field in an extended header record cannot be translated from the pax UTF8 codeset format to the current codeset and locale, pax uses the actual UTF8 encoding for the name.

  • write

    In read or copy mode, pax writes the file, translating or truncating the name, regardless of whether this may overwrite an existing file with a valid name. In list mode, pax behaves identically to the bypass action.

    If no -o invalid=action is specified, pax acts as if the bypass action is specified. Any overwriting of existing files that may be allowed by the -o invalid=actions is subject to permission (-p) and modification time (-u) restrictions, and is suppressed if the -k flag is also specified.

linkdata (Applicable only to the -x pax format.)

In write mode, pax writes the contents of a file to the archive, even when that file is merely a hard link to a file whose contents have already been written to the archive.

Item Description
-o Options (Continued)

listopt=format (Applicable to all file formats.)

This keyword specifies the output format of the table of contents produced when the -v option is specified in list mode. To avoid ambiguity, this keyword-value pair should be used as the only or final keyword-value pair following the -o flag; all characters in the remainder of the option-argument are considered part of the format string. If multiple -o listopt=format options are specified, the format strings are considered to be a single, concatenated string, evaluated in command-line order. Please refer to the List-Mode Format Specifications section for more information.

times (Applicable only to the -x pax format.)

When used in write or copy mode, pax includes atime, ctime, and mtime extended header records for each file.

Extended header keywords

(Applicable only to the -x pax format.)

If the -x pax format is specified, any of the keywords and values defined in the list below can be used as parameters to the -o flag, in either of two modes:

keyword=value

When used in write or copy mode, these keyword-value pairs are written into the global extended header records of the new archive. When used in read or list mode, these keyword-value pairs act as if they were present in the global extended header records of the archive being read. In both cases, the given value is applied to all files that do not have a value assigned in their individual extended header records for the specified keyword.

keyword:=value

When used in write or copy mode, these keyword-value pairs are written into the extended header records of each file in the new archive. When used in read or list mode, these keyword-value pairs act as if they were present in the extended header records of each file in the archive being read. In both cases, the given value overrides any value for the specified keyword found in global or file-specific extended header records.

atime

The file access time for the following file(s), equivalent to the value of the st_atime member of the stat structure for a file.

charset

The name of the character set used to encode the data in the following file(s). The entries in this table are defined to refer to known standards:

Item Description
value Formal Standard
"ISO-IR 646 1990" ISO/IEC 646 IRV
"ISO-IR 8859 1 1987" ISO 8859-1
"ISO-IR 8859 2 1987" ISO 8859-2
"ISO-IR 10646 1993" ISO/IEC 10646
"ISO-IR 10646 1993 UTF8" ISO/IEC 10646, UTF8 encoding
"BINARY" None

The encoding is included in an extended header for information only; when pax is used as described, it does not translate the file data into any other encoding. The BINARY entry indicates binary data that is not encoded.

comment

A series of characters used as a comment. All characters in the value field are ignored by pax.

ctime

The file creation time for the following file(s), equivalent to the value of the st_ctime member of the stat structure for a file.

gid

The group ID of the group that owns the file, expressed as a decimal number using digits from ISO/IEC 646. This record overrides the gid field in the following header block(s). When used in write or copy mode, pax includes a gid extended header record for each file whose group ID is greater than 99,999,999.

gname

The group of the following file(s), formatted as a group name in the group database. This record overrides the gid and gname fields in the following header blocks, and any gid extended header record. When used in read, copy, or list mode, pax translates the name from the UTF8 encoding in the header record to the character set appropriate for the group database on the receiving system. If any of the UTF8 characters cannot be translated, and if the -o invalid=UTF8 option is not specified, the results are undefined. When used in write or copy mode, pax includes a gname extended header record for each file whose group name cannot be represented entirely with the letters and digits of the portable character set.

linkpath

The pathname of a link being created to another file, of any type, previously archived. This record overrides the linkname field in the following ustar header block(s).

The following ustar header block determines the type of link created, whether hard or symbolic. In the latter case, the linkpath value is the contents of the symbolic link. pax translates the name of the link (contents of the symbolic link) from the UTF8 encoding to the character set appropriate for the local file system.

When used in write or copy mode, pax includes a linkpath extended header record for each link whose pathname cannot be represented entirely with the members of the portable character set other than NULL.

mtime

The file modification time of the following file(s), equivalent to the value of the st_mtime member of the stat structure for a file. This record overrides the mtime field in the following header block(s). The modification time is restored if the process has the appropriate privilege to do so.

path

The pathname of the following file(s). This record overrides the name and prefix fields in the following header block(s). pax translates the pathname of the file from the UTF8 encoding to the character set appropriate for the local file system. When used in write or copy mode, pax includes a path extended header record for each file whose pathname cannot be represented entirely with the members of the portable character set other than NULL.

realtime.any

The keywords prefixed by realtime are reserved for future POSIX realtime standardization. pax recognizes but silently ignores them.

security.any

The keywords prefixed by security are reserved for future POSIX security standardization. pax recognizes but silently ignores them.

size

The size of the file in octets, expressed as a decimal number using digits from ISO/IEC 646. This record overrides the size field in the following header block(s). When used in write or copy mode, pax includes a size of extended header record for each file with a size value greater than 999,999,999,999.

uid

The user ID of the user that owns the file, expressed as a decimal number using digits from ISO/IEC 646.. This record overrides the uid field in the following header block(s). When used in write or copy mode, pax includes a uid extended header record for each file whose owner ID is greater than 99,999,999.

uname

The owner of the following file(s), formatted as a user name in the user database. This record overrides the uid and uname fields in the following header block(s), and any uid extended header record. When used in read, copy, or list mode, pax translates the name from the UTF8 encoding in the header record to the character set appropriate for the user database on the receiving system. If any of the UTF8 characters cannot be translated, and if the -o invalid=UTF8 option is not specified, the results are undefined. When used in write or copy mode, pax includes a uname extended header record for each file whose user name cannot be represented entirely with the letters and digits of the portable character set.

If the value field is zero length, it deletes any header block field, previously entered extended header value, or global extended header value of the same name.

If a keyword in an extended header record (or in a -o option-argument) overrides or deletes a corresponding field in the ustar header block, pax ignores the contents of that header block field.

Extended header keyword precedence

(Applicable only to the -x pax format.)

This section describes the precedence in which the various header records and fields and command-line options are selected to apply to a file in the archive. When pax is used in read or list modes, it determines a file attribute in this sequence:

  1. If -o delete=keyword-prefix is used, the affected attribute is determined from step (7) if applicable, or ignored otherwise.
  2. If -o keyword:=NULL is used, the affected attribute is ignored.
  3. If -o keyword:=value is used, the affected attribute is assigned the value.
  4. If value exists in a file-specific extended header record, the affected attribute is assigned the value. When extended header records conflict, the last one given in the header takes precedence.
  5. If -o keyword=value is used, the affected attribute is assigned the value.
  6. If a value exists in a global extended header record, the affected attribute is assigned the value. When global extended header records conflict, the last one given in the global header takes precedence.
  7. Otherwise, the attribute is determined from the ustar header block.
Item Description
-p String Specifies one or more file characteristics to be retained or discarded on extraction. The String parameter consists of the characters a, e, m, o, and p. Multiple characteristics can be concatenated within the same string and multiple -p flags can be specified. The specifications have the following meanings:
a
Does not retain file-access times.
e

Retains the user ID, group ID, file mode, access time, modification time, and ACLs.

m
Does not retain file-modification times.
o
Retains the user ID and the group ID.
p
Retains the file modes.

If neither the -e nor the -o flag is specified, or the user ID and group ID are not preserved for any reason, the pax command does not set the S_ISUID and S_ISGID bits of the file mode. If the retention of any of these items fails, the pax command writes a diagnostic message to standard error. Failure to retain any of the items affects the exit status, but does not cause the extracted file to be deleted. If specification flags are duplicated or conflict with each other, the last flag specified takes precedence. For example, if -p eme is specified, file-modification times are retained.

-r Reads an archive file from the standard input.
-s ReplacementString Modifies file- or archive-member names specified by the Pattern or File parameters according to the substitution expression ReplacementString, using the syntax of the ed command. The substitution expression has the following format:

-s /old/new/[gp]

where (as in the ed command), old is a basic regular expression and new can contain an & (ampersand), \n (n is a digit) back references, or subexpression matching. The old string can also contain new-line characters.

Any non-null character can be used as a delimiter (the / (backslash) is the delimiter in the example). Multiple -s flag expressions can be specified; the expressions are applied in the order specified, terminating with the first successful substitution. The optional trailing g character performs as in the ed command. The optional trailing p character 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.

-t Causes the access times of input files to be the same as they were before being read by the pax command.
-U Performs archival and extraction of ACL and Extended Attributes. Attributes include Access control list (ACL) also. If the ACL type is not supported on the Target filesystem then it is converted to the ACL type supported by the Target filesystem. If the EA is not supported on the filesystem then it is not copied. When listing members of the archive this option will list the names of any named extended attributes and the type of any ACLs associated with each file that are part of the archive image.
-u Ignores files that are older than a preexisting file or archive member with the same name.
  • When extracting files, an archive member with the same name as a file in the file system is extracted if the archive member is newer than the file.
  • When writing files to an archive file, an archive member with the same name as a file in the file system is superseded if the file is newer than the archive member. If the -a flag is specified this is accomplished by appending to the archive. Otherwise it is unspecified if this is accomplished by actual replacement in the archive or by appending to the archive.
  • When copying files to a destination directory, the file in the destination hierarchy is replaced by the file in the source hierarchy or by a link to the file in the source hierarchy if the file in the source hierarchy is newer.
-v Writes information about the process. If neither the -r or -w flags are specified, the -v flag produces a verbose table of contents; otherwise, archive member path names are written to standard error.
-w Writes files to the standard output in the specified archive format.
-x Format Specifies the output archive format with the default format being ustar. The pax command recognizes the following formats:
pax
The pax interchange format. The default blocking value for this format for character-special archive files is 10240. Blocking values from 512 to 32256 in increments of 512 are supported.
cpio
Extended cpio interchange format. The default blocking value for this format for character-special archive files is 5120. Blocking values from 512 to 32256 in increments of 512 are supported.
ustar
Extended tar interchange format. The default blocking value for this format for character-special archive files is 10240. Blocking values from 512 to 32256 in increments of 512 are supported.

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

In copy mode, if no -x format is specified, pax behaves as if -x pax were specified.

-X When traversing the file hierarchy specified by a pathname, the pax command does not descend into directories that have a different device ID.
-Z Archives the Encrypted File System (EFS) information of encrypted files or directories. The EFS information is extracted by default. When members of the archive are listed, an e indicator is displayed after the file mode for encrypted files and directories that were archived with the -Z flag, and a hyphen (-) is displayed for other files.
Note: Archives created with the -Z flag can be restored only on AIX 6.1 or later releases.

Flag Interaction and Processing Order

The flags that operate on the names of files or archive members (-c, -i, -n, -s, -u, and -v) interact as follows:

List Mode Format Specifications

In list mode with the -o listopt=format option, the format argument is applied for each selected file. pax appends a newline character to the listopt output for each selected file. The format argument is used as the format string described in printf(), with the following exceptions:

  1. The sequence keyword can occur before a format conversion specifier. The conversion argument is defined by the value of keyword. The following keywords are supported:
    • Any of the field name entries for ustar and cpio header blocks.
    • Any keyword defined for the extended header or provided as an extension within the extended header.

    For example, the sequence %(charset)s is the string value of the name of the character set in the extended header.

    The result of the keyword conversion argument is the value from the applicable header field or extended header, without any trailing NULLs.

    All keyword-values used as conversion arguments are translated from the UTF8 encoding to the character set appropriate for the local file system, user database, etc., as applicable.

  2. An additional conversion character, T, specifies time formats. The T conversion character can be preceded by the sequence keyword=subformat, where subformat is a date format allowed by the date command. The default keyword is mtime and the default subformat is: %b %e %H:%M %Y.
  3. An additional conversion character, M, specifies the file mode string as displayed by the ls -l command. If keyword is omitted, the mode keyword is used. For example, %.1M writes the single character corresponding to the entry type field of the ls -l command.
  4. An additional conversion character, D, specifies the device for block or special files, if applicable. If not applicable and keyword is specified, then this conversion is equivalent to %keyword u. If not applicable and keyword is omitted, this conversion is equivalent to <space>.
  5. An additional conversion character, F, specifies a pathname. The F conversion character can be preceded by a sequence of comma-separated keywords:

    keyword,keyword...

    The values for all the non-null keywords are concatenated together, each separated by a /. The default is path if the keyword path is defined; otherwise, the default is prefix,name.

  6. An additional conversion character, L, specifies a symbolic link expansion. If the current file is a symbolic link, then %L expands to:

    "%s -> %s", value_of_keyword, contents_of_link

    Otherwise, the %L conversion character is equivalent to %F.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 An error occurred.

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To copy the olddir directory hierarchy to newdir, enter:
    mkdir newdir
    pax -rw olddir newdir
  2. To copy the contents of the current directory to the tape drive, enter:
    pax -wf /dev/rmt0
  3. To archive the file xxx as XXX and display the successful substitution, enter:
    pax -wvf/dev/rfd0 -s /xxx/XXX/p xxx
    OR
    pax -wvf/dev/rfd0 -s/x/X/gp xxx
  4. To read a file from a standard input and dump it to a datastream file with a specified size, enter:
    dd if=/dev/hd6 bs=36b count=480 | pax -wf /dev/rfd0 -o
    datastream=_filename_,datastr_size=_size_
  5. To list the files in an archive pax.ar in a specified format, enter:
    pax -v -o listopt="start %F end" -f pax.ar
  6. To create an archive pax.ar in pax format, enter :
    pax -wf pax.ar -x pax file1
  7. To extract a file from an archive pax.ar in pax format with a new path, enter :
    pax -rvf pax.ar -x pax -o path=newfilename
  8. To copy the contents of a symbolic link from source to destination, enter:
    pax -rwL srclink destdir
  9. To extract files from the archive with group name as bin, enter:
    pax -rvf pax.ar -x pax -o gname=bin
  10. To ignore the path name from the archive in pax format during extraction, enter:
    pax -rvf pax.ar -o delete=path
  11. To avoid the truncation of long user and group names while creating the archive, enter:
    pax -wEf file.pax file
  12. To copy the olddir directory hierarchy to newdir with ACL and EA associated with the files, enter:
    mkdir newdir
    
    pax -rUw olddir newdir

Files

Item Description
/usr/bin/pax Contains the pax command.