📄 pax.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>pax</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1688"> </a>NAME</h4><blockquote>pax - portable archive interchange</blockquote><h4><a name = "tag_001_014_1689"> </a>SYNOPSIS</h4><blockquote><pre><code>pax <b>[</b>-cdnv<b>][</b>-f <i>archive</i><b>][</b>-s <i>replstr</i><b>]</b>...<b>[</b><i>pattern</i>...<b>]</b>pax -r<b>[</b>-cdiknuv<b>][</b>-f <i>archive</i><b>][</b>-o <i>options</i><b>]</b>...<b>[</b>-p <i>string</i><b>]</b>...<b>[</b>-s <i>replstr</i><b>]</b>...<b>[</b><i>pattern</i>...<b>]</b>pax -w<b>[</b>-dituvX<b>][</b>-b <i>blocksize</i><b>][[</b>-a<b>][</b>-f <i>archive</i><b>][</b>-o <i>options</i><b>]</b>...<b>[</b>-s <i>replstr</i><b>]</b>...<b>[</b>-x <i>format</i><b>][</b><i>file</i>...<b>]</b>pax -r -w<b>[</b>-diklntuvX<b>][</b>-p <i>string</i><b>]</b>...<b>[</b>-s <i>replstr</i><b>]</b>...<b>[</b><i>file</i>...<b>]</b><i>directory</i></code></pre></blockquote><h4><a name = "tag_001_014_1690"> </a>DESCRIPTION</h4><blockquote>The<i>pax</i>utility reads, writes and writes lists of the members of archivefiles and copy directory hierarchies.A variety of archive formatsare supported; see the<b>-x</b> <i>format</i>option.<p>The action to be taken depends on the presence of the<b>-r</b>and<b>-w</b>options.The four combinations of<b>-r</b>and<b>-w</b>are referred to as the four modes of operation:<i>list</i>,<i>read</i>,<i>write</i>and<i>copy</i>modes, corresponding respectively to the four forms shown in theSYNOPSIS section.<dl compact><dt>list<dd>In list mode (when neither<b>-r</b>nor<b>-w</b>are specified),<i>pax</i>writes the names of the members of the archive file read fromthe standard input, with pathnames matching the specifiedpatterns, to standard output.If a named file is oftype directory, the file hierarchy rooted at that filewill be written out as well.<dt>read<dd>In read mode (when<b>-r</b>is specified, but<b>-w</b>is not),<i>pax</i>extracts the members of the archive file read fromthe standard input, with pathnames matching the specified patterns.If an extracted file is of type directory, thefile hierarchy rooted at that file will be extracted as well.The extracted files is created relative to thecurrent file hierarchy.The ownership, access and modification times,and file mode of the restored filesare discussed under the<b>-p</b>option.<dt>write<dd>In write mode (when<b>-w</b>is specified, but<b>-r</b>is not),<i>pax</i>writes the contents of the file operands to thestandard output in an archive format.If no<i>file</i>operands are specified, a list of files to copy,one per line, will be read from the standard input.A file of type directorywill include all of the files in the file hierarchy rootedat the file.<dt>copy<dd>In copy mode (when both<b>-r</b>and<b>-w</b>are specified),<i>pax</i>copies the file operands to the destination directory.If no<i>file</i>operands are specified, a list of files to copy,one per line, will be read from the standard input.A file of type directory will include all of the files inthe file hierarchy rooted at the file.The effect of the copy is as if the copied fileswere written to an archive file and then subsequentlyextracted, except that there may be hard links between theoriginal and the copied files.If the destination directoryis a subdirectory of one of the files to be copied, theresults are unspecified.If the destination directory isa file of a type not defined by the <b>XSH</b> specification, the resultsare implementation-dependent;otherwise it is an errorfor the file named by the directory operand not to exist,not be writable by the user, or not be a file of type directory.</dl><p>In read or copy modes,if intermediate directories arenecessary to extract an archive member,<i>pax</i>will perform actions equivalent to the <b>XSH</b> specification<i><a href="../xsh/mkdir.html">mkdir()</a></i>function, called with the following arguments:<ul><p><li>the intermediate directory used as the<i>path</i>argument<p><li>the value of the bitwise inclusive OR of S_IRWXU,S_IRWXG and S_IRWXO as the<i>mode</i>argument.<p></ul><p>If any specified<i>pattern</i>or<i>file</i>operands are not matched by atleast one file or archive member,<i>pax</i>will write a diagnostic message to standard errorfor each one that did not match and exit with a non-zero exit status.<p>The supported archive formats are automatically detected on input.The default output archive format is implementation-dependent.<p>A single archive can span multiple files.The<i>pax</i>utility determines,in an implementation-dependent manner, what file to reador write as the next file.<p>If the selected archive format supports the specification oflinked files, it is an error if these files cannot belinked when the archive is extracted.Any of the various names in the archive that representa file can be used to select the file for extraction.</blockquote><h4><a name = "tag_001_014_1691"> </a>OPTIONS</h4><blockquote>The<i>pax</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> ,except that the order of presentation of the<b>-s</b>options is significant.<p>The following options are supported:<dl compact><dt><b>-r</b><dd>Read an archive file from standard input.<dt><b>-w</b><dd>Write files to the standard output in the specified archive format.<dt><b>-a</b><dd>Append files to the end of the archive.It is implementation-dependent whichdevices on the system support appending.Additional file formatsunspecified by this specificationmay impose restrictions on appending.<dt><b>-b </b><i>blocksize</i><dd>Block the output at a positive decimal integer number ofbytes per write to the archive file.Devices and archive formats may impose restrictions on blocking.Blocking is automatically determined on input.Portable applications must not specify a<i>blocksize</i>value larger than 32256.Default blocking when creating archives depends on the archive format.(See the<b>-x</b>option below.)<dt><b>-c</b><dd>Match all file or archive members except those specified by the<i>pattern</i>or<i>file</i>operands.<dt><b>-d</b><dd>Cause files of type directory being copied or archived orarchive members of type directory being extracted to matchonly the file or archive member itself and not the filehierarchy rooted at the file.<dt><b>-f </b><i>archive</i><dd>Specify the pathname of the inputor output archive,overriding the default standard input(in list or read modes)or standard output (write mode).<dt><b>-i</b><dd>Interactively rename files or archive members.For each archive member matching a<i>pattern</i>operand or file matching a<i>file</i>operand, a prompt will be written to the file<b>/dev/tty</b>.The prompt will contain the name of the fileor archive member, but the format is otherwise unspecified.A line will then be read from<b>/dev/tty</b>.If this line is blank, the file or archive member will be skipped.If this line consists of a single period,the file or archive member will be processed with nomodification to its name.Otherwise, its name will bereplaced with the contents of the line.The<i>pax</i>utility will immediately exit with a non-zero exit status ifend-of-file is encountered when reading a response or if<b>/dev/tty</b>cannot be opened for reading and writing.<dt><b>-k</b><dd>Prevent the overwriting of existing files.<dt><b>-l</b><dd>(The letter ell.)Link files.In copy mode,hard links will be made between the sourceand destination file hierarchies whenever possible.<dt><b>-n</b><dd>Select the first archive member that matches each<i>pattern</i>operand.No more than one archive member will be matchedfor each pattern (although members of type directorywill still match the file hierarchy rooted at that file).<dt><b>-o </b><i>options</i><dd>Provide information to the implementationto modify the algorithm for extractingor writing files that is specific tothe file format specified by<b>-x</b>.This issue does not specify any such options and a portable applicationmust not use the<b>-o</b>option.<dt><b>-p </b><i>string</i><dd>Specify one or more file characteristic options (privileges).The<i>string</i>option-argument must be a string specifying filecharacteristics to be retained or discarded on extraction.The string consists of the specification charactersa,e,m,oandp.Other, implementation-dependent, characters can be included.Multiple characteristics can be concatenatedwithin the same string and multiple<b>-p</b>options can be specified.The meaning of the specification charactersare as follows:<dl compact><dt>a<dd>Do not preserve file access times.<dt>e<dd>Preserve the user ID, group ID, file mode bits (see<b>file mode bits</b>in the <b>XBD</b> specification, <a href="../xbd/glossary.html"><b>Glossary</b> </a> ), access time,modification time and any other, implementation-dependent,file characteristics.<dt>m<dd>Do not preserve file modification times.<dt>o<dd>Preserve the user ID and group ID.<dt>p<dd>Preserve the file mode bits.Other, implementation-dependent file-mode attributes may be preserved.</dl><p>In the preceding list, "preserve" indicatesthat an attribute stored in the archivewill be given to the extracted file,subject to the permissions of the invoking process;otherwise, the attribute will be determinedas part of the normal file creation action.<p>If neither theenor theospecification character isspecified, or the user ID and group ID are not preservedfor any reason,<i>pax</i>will not set the S_ISUID and S_ISGIDbits of the file mode.<p>If the preservation of any of these items fails for any reason,<i>pax</i>will write a diagnostic message to standard error.Failure to preserve these itemswill affect the final exit status, but will not cause theextracted file to be deleted.<p>If file-characteristic letters in any of the<i>string</i>option-arguments are duplicated or conflict with each other,the ones given last will take precedence.For example, if<b>-p eme</b>is specified, file modification times will be preserved.<br><br><dt><b>-s </b><i>replstr</i><dd>Modify file or archive member names named by<i>pattern</i>or<i>file</i>operands according to the substitution expression<i>replstr</i>,using the syntax of the<i><a href="ed.html">ed</a></i>utility.The concepts of "address" and "line" aremeaningless in the context of the<i>pax</i>utility, and must not be supplied.The format is:<pre><code>-s /<i>old</i>/<i>new</i>/<b>[</b>gp<b>]</b></code></pre>where as in<i><a href="ed.html">ed</a></i>,<i>old</i>is a basic regular expression and<i>new</i>can contain an ampersand, \<i>n</i> (where <i>n</i> is a digit)backreferences,or subexpression matching.The<i>old</i>string also is permitted to containnewlinecharacters.<p>Any non-null character can be used as a delimiter(/shown here).Multiple<b>-s</b>expressions can be specified; the expressions will be applied inthe order specified,terminating with the first successful substitution.The optional trailinggis as defined in the<i><a href="ed.html">ed</a></i>utility.The optional trailingpcauses successful substitutions to be written to standard error.File or archive membernames that substitute to the empty string are ignored whenreading and writing archives.<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -