HP-UX Reference (11i v2 07/12) - 1 User Commands N-Z (vol 2)
p
pax(1) pax(1)
The extracted files are created relative to the current file hierarchy. The
-r flag can be specified with the
-c, -d, -f, -n,
-s, and -v flags, and a pattern argument.
The access and modification times of the extracted files are the same as the archived files. The access per-
missions of the extracted files remain as archived unless affected by the user’s default file creation mode.
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 options.
If the selected archive format supports the specification of linked files (both the
tar and cpio formats
do), it is an error if these files cannot be linked when the archive is extracted.
pax informs you of the
error and continues processing.
Writing Archive Files
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 arguments to the standard output in an archive format. If no file arguments are
specified, a list of files to copy, one per line, is read from the standard input. When the file argument
specifies a directory, all of the files contained in the directory are written. The
-w flag can be specified with
the
-b, -d, -f, -i, -s, -t, -u, -v,
-x, and -X flags and with file arguments.
If
-w is specified, but no files are specified, standard input is used. If neither
-f or -w are specified,
standard input must be an archive file.
Copying Files
When both the
-r and -w flags are specified, the pax command copies the files specified by the file argu-
ments to the destination directory specified by the directory argument. If no file arguments 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, -p, -n, -s, -t, -u, -v, and
-X flags and with the file arguments. A directory argument 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.
RETURN VALUE
The
pax command returns a value of 0 (zero) if all files were successfully processed; otherwise,
pax
returns a value greater than 0 (zero).
EXAMPLES
To copy the contents of the current directory to the tape drive, enter:
pax -w -f /dev/rmt/0m .
To copy the olddir directory hierarchy to newdir enter:
mkdir newdir
cd olddir
pax -rw olddir newdir
To read the archive a.pax, with all files rooted in the directory /usr in the archive extracted relative to
the current directory, enter:
pax -r -s ’,//*usr//*,,’ -f a.pax
All of the preceding examples create archives in tar format.
The following pairs of commands demonstrate conversions from cpio and tar to pax. In all cases, the
examples show comparable command-line usage rather than identical output formats. The -x flag can be
specified to the pax commands shown here, producing archives to select specific output formats:
ls * | cpio -ocv
pax -wdv *
find /mydir -type f -print | cpio -oc
find /mydir -type f -print | pax -w
cpio -icdum < archive
pax -r < archive
146 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: December 2007 Update