|
|
HP-UX Reference > Ppax(1)HP-UX 11i Version 2: December 2007 Update |
|
NAMEpax — Extracts, writes, and lists archive files; copies files and directory hierarchies SYNOPSISDESCRIPTIONThe 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 archive operation performed by the pax command. The pattern argument specifies a pattern that matches one or more paths of archive members. A \ (backslash) character is not recognized in the pattern argument and it prevents the subsequent character from having any special meaning. If no pattern argument is specified, all members are selected in the archive. If a pattern argument is specified, but no archive members are found that match the pattern specified, the pax command detects the error, exits with a nonzero exit status, and writes a diagnostic message. The pax command can read both tar and cpio archives. In the case of cpio, this means that pax can read ASCII archives (which are created with cpio -c) and binary archives (which are created without the -c flag). The supported archive formats are automatically detected on input. pax can also write archives that tar and cpio can read; by default, pax writes archives in the ustar extended tar interchange format. pax also writes ASCII cpio archives; use the -x cpio flag to specify this extended cpio output format. Options
Option Interaction and Processing OrderThe flags that operate on the names of files or archive members (-c, -i, -n, -s, -u, and -v) interact as follows. When extracting files (-r flag), archive members are selected, using the modified names, according to the user-specified pattern arguments as modified by the -c, -n, and -u flags. Then, any -s and -i flags modify, in that order, the names of the selected files. The -v flag writes the names resulting from these modifications. When writing files to an archive file (-w flag), or when copying files, the files are selected according to the user-specified pathnames as modified by the -n and -u flags. Then, any -s and -i flags modify, in that order, the names resulting from these modifications. The -v flag writes the names resulting from these modifications. If both the -u and -n flags are specified, the pax command does not consider a file selected unless it is newer than the file to which it is compared. Listing Member Files of Archived FilesWhen neither the -r nor the -w flags are specified, the pax command writes the names of the members of the archive file read from the standard input, with pathnames matching the specified patterns, to the standard output. If a named file is a directory, the file hierarchy contained in the directory is also written. You can specify the pax command without the -r or -w flags with the -c, -d, -f, -n, -s, and -v flags, and with the pattern argument. If neither the -r or -w flags are included, pax lists the contents of the specified archive, one file per line. pax lists hard link pathnames as follows: pathname==linkname pax lists symbolic link pathnames as follows: pathname->linkname In both of the preceding cases, pathname is the name of the file that is being extracted, and linkname is the name of a file that appeared earlier in the archive. If the -v flag is specified, the listing of hard link pathnames is output in the ls -l command format. Extracting Archive FilesWhen the -r flag is specified, but the -w flag is not, the pax command extracts the members of an archive file read from the standard input, and with pathnames matching the pattern argument if one is specified. If an extracted file is a directory, the file hierarchy contained in the directory is also extracted. 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 permissions 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 FilesWhen 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 FilesWhen both the -r and -w flags are specified, the pax command copies the files specified by the file arguments 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 VALUEThe pax command returns a value of 0 (zero) if all files were successfully processed; otherwise, pax returns a value greater than 0 (zero). EXAMPLESTo 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 (cd /fromdir;find . -print) | cpio -pdlum /todir pax -rwl /fromdir /todir tar cf archive * pax -w -f archive * tar xfv - < archive pax -rv < archive (cd /fromdir; tar cf - . ) | (cd /todir; tar xf -) pax -rw /fromdir /todir WARNINGSBecause of industry standards and interoperability goals, pax does not support the archival of files larger than 8GB or files that have user/group IDs greater than 2048K. Files with user/group IDs greater than 2048K are archived and restored under the user/group ID of the current process, unless the uname/gname exists. STANDARDS CONFORMANCEpax: XPG4, POSIX.2 This implementation of pax is based upon a POSIX.2 draft specification. HP intends to update pax to meet the final POSIX.2 Standard once it completes, and thus the pax implementation is likely to change in a future release of HP-UX, possibly in ways incompatible with the current implementation. HP recommends using the current implementation only if absolutely necessary. |
|