pax(1) pax(1)NAME pax - copy files to or from an archive in an IEEE format SYNOPSIS pax [-cimopuvy] [-f archive] [-s replstr] [-t device] [pattern]... pax -r [-cimnopuvy] [-f archive] [-s replstr] [-t device] [pattern]... pax -w [-adimuvy] [-b blocking] [-f archive] [-s replstr] [-t device] [-x format] [pathname]... pax -rw [-ilmopuvy] [-s replstr] [pathname]... directory DESCRIPTION pax reads and writes archive files that conform to the "Archive/Interchange File Format" specified in IEEE Standard 1003.1-1988. pax can also read, but not write, a number of other file formats in addition to those specified in the description "Archive/Interchange File Format". Support for these traditional file formats, such as V7 tar and System V cpio, is provided for backward compatibility and to maximize portability. pax also supports traditional cpio and tar interfaces if in- voked with the name cpio or tar, respectively. See cpio(1) or tar(1) for more details. Combinations of the -r and -w command line arguments specify whether pax reads, writes, or lists the contents of the specified archive, or moves the specified files to another directory. The command-line arguments are: -w Write the files and directories specified by pathname arguments to the standard output together with the pathname and status information prescribed by the ar- chive format used. The placeholder pathname refers to a file or a directory. If it is a directory, pax re- cursively traverses all the files and subdirectories of pathname as well. If pathname is not 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. -r Cause pax to read an archive file from the standard in- put. Only files with names that match any of the pat- tern arguments are selected for extraction. The selected files are conditionally created and copied re- lative to the current directory tree, subject to the options described below. By default, the owner and group of selected files is that of the invoking pro- cess, and the permissions and modification times are April, 1990 1
pax(1) pax(1)the same as those in the archive. The supported archive formats are automatically detect- ed on input. The default output format is ustar, but may be overridden by the -x flag option described below. -rw Cause pax to read the files and directories referred to in pathname and copy them to the destination directory. The placeholder pathname refers to the files and (re- cursively) subdirectories of that directory. If pathname is not given, 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. The directory directory must exist and have the proper permissions before the copy can occur. If neither the -r or -w options are given, then pax lists the contents of the specified archive. In this mode, pax lists normal files one per line, lists non-symbolic link pathnames as pathname == linkname and lists symbolic link pathnames, if supported by the im- plementation, as pathname -> linkname where pathname is the name of the file being extracted and linkname is the name of a file that appeared earlier in the archive. If the -v option is specified, then pax list normal pathnames in the same format used by the ls utility with the -l option. Non-symbolic links are shown as <listing> == linkname and symbolic links, if supported, are shown as <listing> -> linkname pax is capable of reading and writing archives that span multiple physical volumes. Upon detecting an end-of-medium on an archive that is not yet completed, pax prompts the user for the next volume of the archive and allows the user to specify the location of the next volume. 2 April, 1990
pax(1) pax(1)pax exits with one of two types of values. If all of the files in the archive were processed successfully, pax exits with a value of 0. If pax aborted due to errors encountered during operation, pax exits with a nonzero value. FLAG OPTIONS The following flag options are available: -a Append the files specified by pathname to the specified archive. -b blocking Block the output at blocking bytes per write to the archive file. A k suffix multiplies blocking by 1024, a b suffix multiplies blocking by 512, and an m suffix multiplies blocking by 1048576 (1 megabyte). For machines with 16-bit integers the maximum buffer size is one byte less than 32 KB. If not specified, blocking is automatically deter- mined on input and is ignored for -rw. -c Exclude the files and directories that match pat- tern. -d Do no create intermediate directories not expli- citly listed in the archive. This option is ig- nored unless the -r option is specified. -f archive Specify the archive as the pathname of the input or output archive and override the default of standard input for -r or standard output for -w. -i Interactively rename files. Substitutions speci- fied by -s options (described below) are performed before requesting the new filename from the user. A file is skipped if an empty line is entered and pax exits with an exit status of 0 if the end-of- file signal is encountered. -l Link files rather than copy them, when possible. -m Do not retain file modification times. -n When -r is specified, but -w is not, the pattern arguments are treated as ordinary filenames. Only the first occurrence of each of these files in the input archive is read. The pax utility exits with an exit status of 0 after all files in the list are read. If one or more files in the list is not found, pax writes a diagnostic to standard error for each of the files and exits with a non-zero April, 1990 3
pax(1) pax(1)exit status. The file names are compared before any of the -i, -s, or -y options are applied. -o Restore file ownership as specified in the ar- chive. The invoking process must have appropriate privileges to accomplish this. -p Preserve the access time of the input files after they have been copied. -s replstr Modify filenames according to the substitution ex- pression using the syntax of ed(1) as shown: -s /old/new/[gp] Any nonnull character may be used as a delimiter. For the example shown, / is used as the delimiter. Multiple -s expressions may be specified; the ex- pressions are applied in the order specified, ter- minating with the first successful substitution. The optional trailing p causes successful mappings to be listed on standard error. The optional trailing g causes the old expression to be re- placed each time it occurs in the source string. Files that substitute to an empty string are ig- nored both on input and output. -t device Name the input or output archive device by using device as an implementation-defined identifier. This overrides the default of standard input for -r and standard output for -w. -u Copy each file only if it is newer than a pre- existing file with the same name. This implies -a. -v List filenames as they are encountered. This pro- duces a verbose list of the table of contents on the standard output when both -r and -w are omit- ted; otherwise, the filenames are printed to stan- dard error as they are encountered in the archive. -x format Specify the output archive format. The input for- mat, which must be one of the following, is au- tomatically determined when the -r option is used. The supported formats are: cpio The extended CPIO interchange format speci- fied in "Extended CPIO Format" in IEEE Standard 1003.1-1988. 4 April, 1990
pax(1) pax(1)ustar The extended TAR interchange format speci- fied in "Extended TAR Format" in IEEE Stan- dard 1003.1-1988. This is the default ar- chive format. -y Interactively prompt for the disposition of each file. Substitutions specified by -s options (described above) are performed before prompting the user for disposition. The eof signal or an input line starting with the character q after the prompt causes pax to exit. Otherwise, an input line starting with anything other than y causes the file to be ignored. This option cannot be used in conjunction with the -i option. Only the last of multiple -f or -t options take effect. When writing to an archive, the standard input is used as a list of pathnames if pathname is not specified. The format is one pathname per line. Otherwise, the standard input is the archive file, which is formatted according to one of the specifications in "Archive/Interchange File format" in IEEE Standard 1003.1-1988 or to some other implementation-defined format. The user ID and group ID of the process, together with the appropriate privileges, affect the ability of pax to restore ownership and permissions attributes of the archived files. (See format-reading utility in "Archive/Interchange File Format" in IEEE Standard 1003.1-1988.) The options -a, -c, -d, -i, -l, -p, -t, -u, and -y are pro- vided for functional compatibility with the historical cpio and tar utilities. The option defaults were chosen based on the most common usage of these options, therefore, some of the options have meanings different than those of the his- torical commands. Arguments Various arguments are available for reading and writing ar- chives: directory When copying files with pax, directory names the destination directory. To invoke this mode, use both the -r and -w options. The directory must exist and be writable before the copy or an error results. pathname The placeholder pathname is the file to be used as the source of a copy (or the file to be copied into an archive) instead of the files named on the standard input. When a directory is named, pax April, 1990 5
pax(1) pax(1)recursively copies all the files and subdirec- tories of pathname as well. pattern When reading data from an archive, pattern selects particular files in the standard shell-pattern matching notation. The default if pattern is not specified is to select all files. EXAMPLES The following command pax -w -f /dev/rmt0 . copies the contents of the current directory to tape drive 0. The commands mkdir newdir cd olddir pax -rw . newdir copies the contents of olddir to newdir. The command pax -r -s ',/usr/*,,' -f pax.out reads the archive pax.out with all files in the archive un- derneath /usr extracted relative to the current directory. For this example the substition string delimiter is the com- ma. FILES /dev/tty Used to prompt the user for information when the -i or -y options are specified SEE ALSO cpio(1), find(1), tar(1), cpio(4), tar(4). DIAGNOSTICS pax terminates immediately, without processing any addition- al files on the command line or in the archive, in the event of errors. BUGS Special permissions may be required to copy or extract spe- cial files. Device, user ID, and group ID numbers larger than 65535 cause additional header records to be output. These records are ignored by some historical versions of cpio(1) and 6 April, 1990
pax(1) pax(1)tar(1). The archive formats described in "Archive/Interchange File Format" have certain restrictions that have been carried over from historical usage. For example, there are restric- tions on the length of pathnames stored in the archive. When getting an ls -l style listing on tar format archives, link counts are listed as 0 because the ustar archive format does not keep link-count information. ADDITIONAL COPYRIGHT INFORMATION Portions of this manual page were previously copyrighted (c) 1989 by Mark H. Colburn. Public distribution has been spon- sored by the USENIX Association. April, 1990 7