📄 pax.1
字号:
duplicated or conflict with each other, the one(s) given last will takeprecedence.For example, if.Dl Fl p Ar emeis specified, file modification times are still preserved..It Fl s Ar replstrModify the file or archive member names specified by the.Ar patternor.Ar fileoperands according to the substitution expression.Ar replstr ,using the syntax of the.Xr ed 1utility regular expressions.The format of these regular expressions are:.Dl /old/new/[gp]As in.Xr ed 1 ,.Cm oldis a basic regular expression and.Cm newcan contain an ampersand (&), \\n (where n is a digit) back-references,or subexpression matching.The.Cm oldstring may also contain.Dv <newline>characters.Any non-null character can be used as a delimiter (/ is shown here).Multiple.Fl sexpressions can be specified.The expressions are applied in the order they are specified on thecommand line, terminating with the first successful substitution.The optional trailing.Cm gcontinues to apply the substitution expression to the pathname substringwhich starts with the first character following the end of the last successfulsubstitution. The first unsuccessful substitution stops the operation of the.Cm goption.The optional trailing.Cm pwill cause the final result of a successful substitution to be written to.Dv standard errorin the following format:.Dl <original pathname> >> <new pathname>File or archive member names that substitute to the empty stringare not selected and will be skipped..It Fl tReset the access times of any file or directory read or accessed by.Nm paxto be the same as they were before being read or accessed by.Nm pax ..It Fl uIgnore files that are older (having a less recent file modification time)than a pre-existing file or archive member with the same name.During.Em read ,an archive member with the same name as a file in the file system will beextracted if the archive member is newer than the file.During.Em write ,a file system member with the same name as an archive member will bewritten to the archive if it is newer than the archive member.During.Em copy ,the file in the destination hierarchy is replaced by the file in the sourcehierarchy or by a link to the file in the source hierarchy if the file inthe source hierarchy is newer..It Fl vDuring a.Em listoperation, produce a verbose table of contents using the format of the.Xr ls 1utility with the.Fl loption.For pathnames representing a hard link to a previous member of the archive,the output has the format:.Dl <ls -l listing> == <link name>For pathnames representing a symbolic link, the output has the format:.Dl <ls -l listing> => <link name>Where <ls -l listing> is the output format specified by the .Xr ls 1utility when used with the.Fl loption.Otherwise for all the other operational modes (.Em read , write ,and.Em copy ) ,pathnames are written and flushed to.Dv standard errorwithout a trailing.Dv <newline>as soon as processing begins on that file orarchive member.The trailing.Dv <newline> ,is not buffered, and is written only after the file has been read or written..It Fl x Ar formatSpecify the output archive format, with the default format being.Ar ustar ..Nm Paxcurrently supports the following formats:.Bl -tag -width "sv4cpio".It Ar cpioThe extended cpio interchange format specified in the.St -p1003.2standard.The default blocksize for this format is 5120 bytes.Inode and device information about a file (used for detecting file hard linksby this format) which may be truncated by this format is detected by.Nm paxand is repaired..It Ar bcpioThe old binary cpio format.The default blocksize for this format is 5120 bytes.This format is not very portable and should not be used when other formatsare available.Inode and device information about a file (used for detecting file hard linksby this format) which may be truncated by this format is detected by.Nm paxand is repaired..It Ar sv4cpioThe System V release 4 cpio.The default blocksize for this format is 5120 bytes.Inode and device information about a file (used for detecting file hard linksby this format) which may be truncated by this format is detected by.Nm paxand is repaired..It Ar sv4crcThe System V release 4 cpio with file crc checksums.The default blocksize for this format is 5120 bytes.Inode and device information about a file (used for detecting file hard linksby this format) which may be truncated by this format is detected by.Nm paxand is repaired..It Ar tarThe old BSD tar format as found in BSD4.3.The default blocksize for this format is 10240 bytes.Pathnames stored by this format must be 100 characters or less in length.Only.Em regularfiles,.Em hard links , soft links ,and.Em directorieswill be archived (other file system types are not supported).For backwards compatibility with even older tar formats, a.Fl ooption can be used when writing an archive to omit the storage of directories.This option takes the form:.Dl Fl o Cm write_opt=nodir.It Ar ustarThe extended tar interchange format specified in the.St -p1003.2standard.The default blocksize for this format is 10240 bytes.Pathnames stored by this format must be 250 characters or less in length..El.Pp.Nm Paxwill detect and report any file that it is unable to store or extractas the result of any specific archive format restrictions.The individual archive formats may impose additional restrictions on use.Typical archive format restrictions include (but are not limited to):file pathname length, file size, link pathname length and the type of the file..It Fl B Ar bytesLimit the number of bytes written to a single archive volume to.Ar bytes .The.Ar byteslimit can end with.Li m ,.Li k ,or.Li bto specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.A pair of.Ar byteslimits can be separated by.Li xto indicate a product..Pp.Em Warning :Only use this option when writing an archive to a device which supportsan end of file read condition based on last (or largest) write offset(such as a regular file or a tape drive). The use of this option with a floppy or hard disk is not recommended..It Fl DThis option is the same as the.Fl uoption, except that the file inode change time is checked instead of thefile modification time.The file inode change time can be used to select files whose inode information(e.g. uid, gid, etc.) is newer than a copy of the file in the destination.Ar directory ..It Fl E Ar limitLimit the number of consecutive read faults while trying to read a flawedarchives to.Ar limit .With a positive.Ar limit ,.Nm paxwill attempt to recover from an archive read error and willcontinue processing starting with the next file stored in the archive.A.Ar limitof 0 will cause.Nm paxto stop operation after the first read error is detected on an archive volume.A.Ar limitof.Li NONEwill cause.Nm pax to attempt to recover from read errors forever.The default .Ar limitis a small positive number of retries..Pp.Em Warning: Using this option with.Li NONEshould be used with extreme caution as.Nm paxmay get stuck in an infinite loop on a very badly flawed archive..It Fl G Ar groupSelect a file based on its.Ar groupname, or when starting with a.Cm # ,a numeric gid.A '\\' can be used to escape the.Cm # .Multiple .Fl Goptions may be supplied and checking stops with the first match..It Fl HFollow only command line symbolic links while performing a physical filesystem traversal..It Fl LFollow all symbolic links to perform a logical file system traversal..It Fl PDo not follow symbolic links, perform a physical file system traversal.This is the default mode..It Fl T Ar [from_date][,to_date][/[c][m]]Allow files to be selected based on a file modification or inode changetime falling within a specified time range of .Ar from_dateto.Ar to_date(the dates are inclusive).If only a .Ar from_dateis supplied, all files with a modification or inode change timeequal to or younger are selected.If only a.Ar to_dateis supplied, all files with a modification or inode change timeequal to or older will be selected.When the .Ar from_dateis equal to the.Ar to_date ,only files with a modification or inode change time of exactly thattime will be selected..PpWhen.Nm paxis in the .Em writeor.Em copymode, the optional trailing field.Ar [c][m]can be used to determine which file time (inode change, file modification orboth) are used in the comparison.If neither is specified, the default is to use file modification time only.The.Ar mspecifies the comparison of file modification time (the time whenthe file was last written).The.Ar cspecifies the comparison of inode change time (the time when the fileinode was last changed; e.g. a change of owner, group, mode, etc).When .Ar cand.Ar mare both specified, then the modification and inode change times areboth compared.The inode change time comparison is useful in selecting files whoseattributes were recently changed or selecting files which were recentlycreated and had their modification time reset to an older time (as whathappens when a file is extracted from an archive and the modification timeis preserved).Time comparisons using both file times is useful when.Nm paxis used to create a time based incremental archive (only files that werechanged during a specified time range will be archived)..PpA time range is made up of six different fields and each field must contain twodigits.The format is:.Dl [yy[mm[dd[hh]]]]mm[.ss]Where.Cm yyis the last two digits of the year,the first.Cm mmis the month (from 01 to 12),.Cm ddis the day of the month (from 01 to 31),.Cm hhis the hour of the day (from 00 to 23),the second.Cm mmis the minute (from 00 to 59),and.Cm ssis the seconds (from 00 to 59).The minute field.Cm mmis required, while the other fields are optional and must be added in thefollowing order:.Dl Cm hh , dd , mm , yy .The .Cm ssfield may be added independently of the other fields.Time ranges are relative to the current time, so.Dl Fl T Ar 1234/cmwould select all files with a modification or inode change timeof 12:34 PM today or later.Multiple .Fl Ttime range can be supplied and checking stops with the first match..It Fl U Ar userSelect a file based on its.Ar username, or when starting with a.Cm # ,a numeric uid.A '\\' can be used to escape the.Cm # .Multiple .Fl Uoptions may be supplied and checking stops with the first match..It Fl XWhen traversing the file hierarchy specified by a pathname,do not descend into directories that have a different device ID.See the.Li st_dev field as described in.Xr stat 2for more information about device ID's..It Fl YThis option is the same as the.Fl Doption, except that the inode change time is checked using thepathname created after all the file name modifications have completed..It Fl ZThis option is the same as the.Fl uoption, except that the modification time is checked using thepathname created after all the file name modifications have completed..El.PpThe options that operate on the names of files or archive members (.Fl c ,.Fl i ,.Fl n ,.Fl s ,.Fl u ,.Fl v ,.Fl D ,.Fl G ,.Fl T ,.Fl U ,.Fl Y ,and.Fl Z )interact as follows..PpWhen extracting files during a.Em readoperation, archive members are.Sq selected ,based only on the user specified pattern operands as modified by the.Fl c ,.Fl n ,.Fl u ,.Fl D ,.Fl G ,.Fl T ,.Fl Uoptions.Then any.Fl sand.Fl ioptions will modify in that order, the names of these selected files.Then the.Fl Yand.Fl Zoptions will be applied based on the final pathname.Finally the .Fl voption will write the names resulting from these modifications..PpWhen archiving files during a.Em writeoperation, or copying files during a.Em copyoperation, archive members are.Sq selected ,based only on the user specified pathnames as modified by the.Fl n ,.Fl u ,.Fl D ,.Fl G ,.Fl T ,and .Fl Uoptions (the.Fl Doption only applies during a copy operation).Then any.Fl s and.Fl ioptions will modify in that order, the names of these selected files.Then during a.Em copyoperation the.Fl Yand the.Fl Zoptions will be applied based on the final pathname.Finally the.Fl voption will write the names resulting from these modifications..PpWhen one or both of the.Fl uor.Fl Doptions are specified along with the.Fl noption, a file is not considered selected unless it is newerthan the file to which it is compared..Sh EXAMPLESThe command:.Dl pax -w -f /dev/rst0 .\ copies the contents of the current directory to the device.Pa /dev/rst0 ..PpThe command:.Dl pax -r -v -f filenamegives the verbose table of contents for an archive stored in.Pa filename ..PpThe following commands:.Dl mkdir newdir.Dl cd olddir.Dl pax -rw .\ newdirwill copy the entire.Pa olddirdirectory hierarchy to.Pa newdir ..PpThe command:.Dl pax -r -s ',^//*usr//*,,' -f a.paxreads the archive .Pa a.pax ,with all files rooted in ``/usr'' into the archive extracted relative to thecurrent directory..PpThe command:.Dl pax -rw -i .\ dest_dircan be used to interactively select the files to copy from the currentdirectory to.Pa dest_dir ..PpThe command:.Dl pax -r -pe -U root -G bin -f a.paxwill extract all files from the archive.Pa a.paxwhich are owned by.Em rootwith group.Em binand will preserve all file permissions..PpThe command:.Dl pax -r -w -v -Y -Z home /backupwill update (and list) only those files in the destination directory.Pa /backupwhich are older (less recent inode change or file modification times) thanfiles with the same name found in the source file tree.Pa home ..Sh STANDARDSThe.Nm paxutility is a superset of the.St -p1003.2standard.The options.Fl B ,.Fl D ,.Fl E ,.Fl G ,.Fl H ,.Fl L ,.Fl P ,.Fl T ,.Fl U ,.Fl Y ,.Fl Z ,the archive formats.Ar bcpio ,.Ar sv4cpio ,.Ar sv4crc ,.Ar tar ,and the flawed archive handling during.Ar listand.Ar readoperations are extensions to the.Tn POSIXstandard..Sh AUTHORKeith Muller at the University of California, San Diego.Sh ERRORS.Nm paxwill exit with one of the following values:.Bl -tag -width 2n.It 0All files were processed successfully..It 1 An error occurred..El.PpWhenever.Nm paxcannot create a file or a link when reading an archive or cannotfind a file when writing an archive, or cannot preserve the user ID,group ID, or file mode when the.Fl poption is specified, a diagnostic message is written to.Dv standard errorand a non-zero exit status will be returned, but processing will continue.In the case where pax cannot create a link to a file,.Nm paxwill not create a second copy of the file..PpIf the extraction of a file from an archive is prematurely terminated bya signal or error,.Nm paxmay have only partially extracted a file the user wanted.Additionally, the file modes of extracted files and directoriesmay have incorrect file bits, and the modification and access times may bewrong..PpIf the creation of an archive is prematurely terminated by a signal or error,.Nm paxmay have only partially created the archive which may violate the specificarchive format specification..PpIf while doing a.Em copy ,.Nm paxdetects a file is about to overwrite itself, the file is not copied,a diagnostic message is written to.Dv standard errorand when.Nm paxcompletes it will exit with a non-zero exit status.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -