pax ( 1 ) USER COMMANDSpax ( 1 )


NAME

pax - read, write, and list file archives

SYNOPSIS

pax [ options ] [ pathname ... ]
pax [ options ] [ pattern ... ]
pax [ options ] [ pathname ... directory ]

DESCRIPTION

The pax command reads, writes, and lists archive files in various formats. There are four operation modes controlled by combinations of the -r and -w options.

pax -w writes the files and directories named by the pathname arguments to the standard output together with pathname and status information. A directory pathname argument refers to the files and (recursively) subdirectories of that directory. If no pathname arguments are given then the standard input is read to get a list of pathnames to copy, one pathname per line. In this case only those pathnames appearing on the standard input are copied.

pax -r reads the standard input that is assumed to be the result of a previous pax -w command. Only member files with names that match any of the pattern arguments are selected. Matching is done before any -i or -s options are applied. A pattern is given in the name-generating notation of sh(1), except that the / character is also matched. The default if no pattern is given is * which selects all files. The selected files are conditionally created and copied relative to the current directory tree, subject to the options described below. By default the owner and group of selected files will be that of the current user, and the permissions and modify times will be the same as those in the archive.

pax -rw reads the files and directories named in the pathname arguments and copies them to the destination directory. A directory pathname argument refers to the files and (recursively) subdirectories of that directory. If no pathname arguments are given then the standard input is read to get a list of pathnames to copy, one pathname per line. In this case only those pathnames appearing on the standard input are copied. directory must exist before the copy.

pax (-r and -w omitted) reads the standard input that is assumed to be the result of a previous pax -w command and lists table of contents of the selected member files on the standard output.

The standard archive formats are automatically detected on input. The default output archive format is pax, but may be overridden by the -x option described below. pax archives may be concatenated to combine multiple volumes on a single tape or file. This is accomplished by forcing any format prescribed pad data to be null bytes. Hard links are not maintained between volumes, and delta and base archives cannot be multi-volume.

A single archive may span many files/devices. The second and subsequent file names are prompted for on the terminal input. The response may be:
!command
Execute command via system(3) and prompt again for file name.
EOF
Terminate processing and exit.
CR
An empty input line retains the previous file name.
pathname
The file name for the next archive part.

getconf PATH_RESOLVE determines how symbolic links are handled. This can be explicitly overridden by the --logical , --metaphysical, and --physical options below. PATH_RESOLVE can be one of:
logical
Follow all symbolic links.
metaphysical
Follow command argument symbolic links, otherwise don't follow.
physical
Don't follow symbolic links.

OPTIONS

-A, --action=XpatternXcommand
Input/output file path match and filter command. command is applied to each file that matches pattern as it is read from or written to the archive. X is any delimiter not occurring in pattern. command is split into space separated arguments, and is executed with the pathname of the file to be processed as the last argument. The standard output of the resulting command is read by pax.
-a, --append
Append to end of archive.
--atime[=time]
Preserve or set file access times. The option value may be omitted.
-z, --base=archive
Two archives are required for delta operations. --file names the delta archive and --base names the delta base archive. If archive is - then the base is ignored (the actual delta sizes are reported and restored) on input and the delta is compressed on output.
-b, --blocksize=size
Input/output block size. The default is format specific.
--blok[=i|o]
Input/output BLOK format for tapes on file. The option value may be omitted.
--charset=name
Data character set name.
--checksum=method:path
Generate a method checksum file for each archive member and add the resulting file as the archive member path. See sum(1) for supported checksum methods; md5 is a good candidate. The generated file is suitable for input to sum --check --permissions.
-C, --chmod=mode
Apply the chmod(1) mode expression to file modes written to archive headers.
-k, --clobber
Overwrite output files. On by default; -k means --noclobber.
--comment=text
Comment text.
--complete
Complete archive must fit in one media part.
-X, --crossdevice
Directory traversal may cross device boundaries. On by default; -X means --nocrossdevice.
--ctime[=time]
Preserve or set file change times. The option value may be omitted.
-D, --debug=level
Set debug trace level. Higher levels produce more output.
--delete=pattern
delete=pattern ignores all global and extended header keywords matching the ksh(1) pattern.
--delta.base.checksum|ATT.delta.base.checksum=checksum
The delta base archive checksum.
--delta.base.size|ATT.delta.base.size=size
The delta base archive size.
--delta.checksum|ATT.delta.checksum=checksum
The delta archive checksum not including the current entry.
--delta.compress|ATT.delta.compress
The delta base archive is /dev/null.
--delta.index|ATT.delta.index=index
The base file index (ordinal) of the current delta archive entry.
--delta.method|ATT.delta.method=method
The delta method. Supported methods are:
delta
vdelta difference/compression
delta88
delta88 difference/compression
ignore
ignore delta headers
patch
delta using standard archive formats
--delta.op|ATT.delta.op=op
The current delta archive entry read mode operation:
create
The file is not in the base archive and will be created.
delete
The file will be deleted.
pass
The file is not a delta and will be copied verbatim.
update
The file is a delta and will be updated against the corresponding base archive entry.
verify
No data change but the file metatdata will be updated to match the delta archive.
--delta.ordered|ATT.delta.ordered
The base and delta archive members are ordered (sorted) by name.
-U, --delta.update|ATT.delta.update
Only update files in the delta -- do not update files in the base that are not in the delta.
--delta.version|ATT.delta.version=version
The delta method version.
-d, --descend
Command line directories name themselves and descendents. On by default; -d means --nodescend.
--dots
Print a dot on the standard error for each block transferred.
-s, --edit=,old,new,[glpsu][i]
Pathname substitution from old to new. The first character is the expression delimiter. There may be more than one edit expression; each is applied in order from left to right.
g
All old patterns.
l
Convert new to lower case.
p
Print the edit result on the standard error.
s
Stop edits on path if this edit succeeds.
u
Convert new to upper case.
i
Append member index to pathname in .%04d format.
--entry
File entry ordinal.
--eom=[!][prompt]
End of media prompt or !command. Processing terminates if !command returns non-zero exit status or if ! is specified.
-n, --exact
Exit after each file arg matches exactly once.
--exthdr.name=format
Equivalent to header:=format.
-f, --file=path
The main archive file name.
--filter=command
Input/output file filter command. command is applied to each file as it is read from or written to the archive. command is split into space separated arguments, and is executed with the pathname of the file to be processed as the last argument. The standard output of the resulting command is read by pax . --nodescend is implied by --filter. If command is - and the archive is being written and there are no command line file arguments, then each line on the standard input is interpreted as a delimiter separated command: XoptionsXcommandXphysicalXlogical, where:
X
A delimiter character that does not appear outside quotes.
options
, separated [no]name[=value] options:
logical
Override the command line --logical and --physical options for this file.
physical
Override the command line --logical and --physical options for this file.
command
A shell command that reads the physical file and writes the filtered contents to the standard output. If command is empty then the file contents are copied unchanged.
physical
The actual file path, used for archive status.
logical
The file path as it will appear in the archive. If logical is empty then the physical path is used. The resulting path is still subject to any --edit options.
--forceconvert
Force --from conversion even if the data contains control characters in the first 256 bytes.
-x, --format=format
The archive format. Formats are automatically detected on read. A basic, compress and delta format may be combined, separated by :. Each format may be followed by =details; details are format specific. The supported formats are:
ansi|slt
ANSI standard label tape; for tape devices only
ibm|elt
EBCDIC standard label tape; for tape devices only
binary|binary-cpio
cpio binary with symlinks
cpio
cpio character with symlinks
ustar|tar
POSIX 1003.1-1988 tar
pax
POSIX 1003.1-2001 extended ustar
oldtar
pre-POSIX tar with symlinks
asc
s5r4 extended cpio character
aschk
s5r4 extended cpio character with checksum
vmsbackup
VMS backup savset; for tape devices only; for input only
ar|library
object library archive; for input only
vdb
virtual database
rpm
Redhat rpm package encapsulated cpio; for input only
flash
Solaris flash package encapsulated archive; for input only
mime
encapsulated mime; for input only
tnef
MS outlook transport neutral encapsulation format; for input only
pds
mvs partitioned dataset; for listing only
arj
arj archive; for input only
cab|cabinet
MS cabinet file; for input only
ca-librarian|calib|librarian
mvs CA-librarian file; for input only
lha|lharc
lha archive; for input only
rar
rar archive; for input only
tp
unix 4th-7th edition PDP-11 tp archive; for input only
zip
zip 2.1 / PKZIP 2.04g archive.; for input only
zoo
zoo archive; for input only
omf
omf archive; for input only
pdp11
pdp11 archive; for input only
s5r0
system V release 0 archive; for input only
portable
portable archive; for input only
aix
aix archive; for input only
aixbig
aixbig archive; for input only
local
local ar archive; for input only
----
compression methods ----
compress
Lempel-Ziv compression
gzip
gzip compression
bzip|bzip2
bzip compression
vczip
vcodex compression; the details value is the compression --method=method
----
delta methods ----
delta|delta94|vdelta
vdelta difference/compression
delta88|odelta
delta88 difference/compression; for input only
ignore
ignore delta headers
patch
delta using standard archive formats
The default value is pax.
--from=name
File data input character set name. Only files that have no control characters in the first 256 bytes are converted. The character set names are:
a|ascii|?(iso)?(-)646|?(iso)?(-)8859|latin
8 bit ascii
e|ebcdic?(-)?([1e]
X/Open ebcdic
o|ebcdic?(-)[3o]|?(cp|ibm)1047|open?(-)edition
mvs OpenEdition ebcdic
h|ebcdic?(-)h|?(cp|ibm)?(00)37|[oa]s?(/-)400
ibm OS/400 AS/400 ebcdic
s|ebcdic?(-)s|siemens|posix-bc
siemens posix-bc ebcdic
i|ebcdic?(-)[2i]|ibm
X/Open ibm ebcdic (not idempotent)
m|ebcdic?(-)m|mvs
mvs ebcdic
u|ebcdic?(-)(u|mf)|microfocus
microfocus cobol ebcdic
n|native|local
native code set
un|unicode|utf
multibyte 8-bit unicode
um|ume|utf?(-)7
multibyte 7-bit unicode
big|euc)*
euc family
dos?(-)?(855
dos code page
ucs?(-)?(2)?(be)|utf-16?(be
unicode runes
ucs?(-)?(2)le|utf-16le
little endian unicode runes
--gid=group
Group id. The default is the group id of the invoking process.
--globexthdr.name=format
Equivalent to header=format.
--gname=group
Group name. The default is the group name of the invoking process..
--header=format
header=format sets the global header path name format to the listopt format. The default is %(dir)s/PaxHeaders/%(file)s when strict conformance is in effect (see getconf(1) CONFORMANCE) and @PaxHeaders/%(sequence)s otherwise. header:=format sets the extended header path name format to the listopt format. The default is %(tmp)s/GlobalHead/%(entry)s when strict conformance is in effect and @PaxGlobals/%(sequence)s otherwise. The strict conformance defaults are prone to global header filename collisions and are ill-defined when extended header names exceed the underlying header format limits.
--ignore=pattern
ignore=pattern ignores all global and extended header keywords matching the ksh(1) pattern; ignore:=pattern ignores all extended header keywords matching pattern.
--install=path
Generate an installation sh(1) script file that contains chmod(1), chgrp(1) and chown(1) commands to restore file modes and ownership not supported by standard cpio(1) and tar(1). Only files with user or group specific read/execute/setuid permissions are included in the script. The script is added to the archive with member name path.
-I, --intermediate
Copy each file to an intermediate name and rename to the real name if the intermediate copy succeeds; otherwise retain the original file and issue a diagnostic.
--invalid=action
Invalid path action:
i|bypass|ignore
Silently ignore.
p|rename|prompt
Prompt for new name.
t|write|translate
Automatically translate and/or truncate to local specifications.
utf-8|UTF-8
Convert to UTF-8.
-c, --invert
Invert pattern match sense. The !(...) construct is more general.
-K, --keepgoing
Attempt to skip over damaged input archive data.
--label=string
Append string to the volume label; label:=string prepends string .
-l, --link
Hard link files on output if possible.
--linkdata
Output data with each hard link. The default outputs the data only with the first link in the archive.
--linkpath=path
Symbolic link pathname.
--listformat|listopt=format
Append to the member listing format string. format follows printf(3) conventions, except that sfio(3) inline ids are used instead of arguments: %[-+][width[.precis[.base]]](id[:subformat])char. If char is s then the string form of the item is listed, otherwise the corresponding numeric form is listed. subformat overrides the default formatting for id. All of the file related options are supported as ids, along with the following:
chksum
The header checksum string; empty if not supported.
device
The device major and minor number string, empty if not a device file.
devmajor
The major device number, 0 if not supported.
devminor
The minor device number, 0 if not supported.
dir
File directory name (base elided).
ino
The file serial number, 0 if not supported.
linkop
The link operation string, == for hard links, -> for symbolic links, otherwise empty.
magic
The header magic string; empty if not supported.
mark
The file type mark character string:
=
hard link
@
symbolic link
/
directory
|
fifo
=
socket
$
block or character special
*
executable
mode
The file type and acces mode.
nlink
The hard link count.
sequence
The archive member sequence number. Numbers for volumes >1 are of the form volume.sequence.
typeflag
The header type flag string; empty if not supported.
version
The header version string; empty if not supported.
----
subformats ----
case:p1:s1:...:pn:sn
Expands to si if the value of id matches the shell pattern pi, or the empty string if there is no match.
mode
The integral value as a fmtmode(3) string.
perm
The integral value as a fmtperm(3) string.
time[=format]
The integral value as a strftime(3) string. For example, --format="%8(mtime)u %(ctime:time=%H:%M:%S)s" lists the mtime in seconds since the epoch and the ctime as hours:minutes:seconds.
--listmacro=name[=value]
Define a --listformat macro.
--local
Reject files and links that traverse outside the current directory.
-L, --logical|follow
Follow symbolic links. The default is determined by getconf PATH_RESOLVE.
--maxout=size
Output media size limit.
-H, --metaphysical
Follow command argument symbolic links, otherwise don't follow. The default is determined by getconf PATH_RESOLVE.
-m, --meter
Display a one line text meter showing archive read progress. The input must be seekable. compress and bzip uncompressed input size is estimated.
--mkdir
Create intermediate directories on output. On by default.
--mtime[=time]
Preserve or set file modify times. The option value may be omitted.
--name
File base name (directory elided).
-o, --options=string
Set options without leading -- from string.
-O, --ordered
Input files and base are ordered by name.
--owner=uid
Change output file owner to current user or to uid if specified.
-E, --passphrase=passphrase
Passphrase for formats that support encryption. The default value is prompted on and read from /dev/tty.
--path=path
File path name.
-P, --physical
Don't follow symbolic links. The default is determined by getconf PATH_RESOLVE.
--pid
pax process id.
-p, --preserve[=aemops]
Preserve selected file attributes:
a
Don't preserve access time.
e
Preserve everything permissible.
m
Don't preserve modify time.
o
Preserve user, group, setuid and setgid.
p
Preserve mode.
s
Preserve setuid and setgid.
The option value may be omitted.
-r, --read
Read files from the archive.
--record-charset
Enable character set translation. On by default.
--record-delimiter=char
vdb format record delimiter character. No delimiter if omitted. The default is ; .
--record-format=DFSUV
Labeled tape record format:
D
decimal variable
F
fixed length
S
spanned
U
input block size
B
binary variable
--record-header
Member header, NULL if omitted. The default value is format specific.
--record-line
Records are lines. The default is format specific.
--record-match=pattern
Select record formats that match pattern.
--record-pad
Pad records. The default is format specific.
--record-size=size
Fixed length record size. The default is format specific.
--record-trailer=string
Member trailer, NULL if omitted. The default is format specific.
--release|ATT.release=string
The pax implementation release stamp.
-t, --reset-atime
Reset the file access times of copied files.
--size[=size]
File size. The option value may be omitted.
-S, --strict
Disable non-standard extensions. The default is determined by the getconf(1) CONFORMANCE setting.
--summary
List summary information for each archive. On by default.
--symlink
symlink files if possible.
-F, --sync|fsync
fsync(2) each file after it is copied.
--tape=[#][lmhcu][n][bv][s[#]][k[#]]
Canonical tape unit name and operations.
#
unit number [0-9]
l
low density
m
medium density
h
high density
c
compressed
u
uncompressed
n
don't rewind on close
b
bsd behavior
v
system V behavior
s[#]
skip all [#] volumes
k[#]
keep all [#] volumes after skip
-T, --test=mask
Test mask for debugging. Multiple values are or'ed together.
--testdate=date
--listformat time values newer than date will be printed as date . Used for regression testing.
--times
Preserve atime, ctime, and mtime.
--tmp
The value of the TMPDIR environment variable if defined, otherwise /tmp.
--to=name
Output character set. See --from above for supported character set names.
--uid=user
User id. The default is the user id of the invoking process.
--uname=user
User name. The default is the user name of the invoking process.
--unblocked=i|o
Force unblocked input/output. The default is format specific. Both input and output are unblocked if the value is omitted.
--uncompressed|delta.size|ATT.uncompressed|ATT.delta.size=size
The uncompressed size of the current archive entry, 0 if the entry is not compressed.
-u, --update
Only copy archive members that are newer than the target files.
-v, --verbose
Produce long listings or list each file name as it is processed.
-i, --verify
Prompt for verification and/or rename.
-W, --warn
Enable archive format specific warnings.
-w, --write
Write files to the archive.
-y, --yes
Prompt for yes/no file verification.

DIAGNOSTICS

The number of files, blocks, and optionally the number of volumes and media parts are listed on the standard error. For -v the input archive formats are also listed on the standard error.

EXAMPLES

pax -w -t 1m .
Copies the contents of the current directory to tape drive 1, medium density.
mkdir newdir; cd olddir; pax -rw . newdir
Copies the olddir directory hierarchy to newdir.

SEE ALSO

ar(1), cpio(1), find(1), getconf(1), gzip(1), ksh(1), ratz(1), star(1), tar(1), tw(1), fsync(2), libdelta(3), cpio(5), tar(5)

BUGS

Special privileges may be required to copy special files. Some archive formats have hard upper limits on member string, numeric and data sizes. Attribute values larger than the standard min-max values may cause additional header or embedded data records to be output for some formats; these records are ignored by old versions of cpio(1) and tar(1). --format=pax avoids size and portability limitations but requires a working reader on the receiving side.

IMPLEMENTATION

version
pax (AT&T Research) 2009-01-18
author
Glenn Fowler <gsf@research.att.com >
copyright
Copyright © 1987-2009 AT&T Intellectual Property
license
http://www.opensource.org/licenses/cpl1.0.txt