diff options
author | Jared Yanovich <jaredy@cvs.openbsd.org> | 2005-06-02 16:27:09 +0000 |
---|---|---|
committer | Jared Yanovich <jaredy@cvs.openbsd.org> | 2005-06-02 16:27:09 +0000 |
commit | 7aa16a6ce4595ff7ecb16a8778d5d3c98e0c4e7f (patch) | |
tree | b0fe417a98fc26f306f1aeb2caf1eebc334a6b41 | |
parent | 0ca9c2501c0cb1f235000d3aff2682e7dc051b18 (diff) |
- simplify usage
- rearrange examples
- layout tweaks
- minor macro, punctuation, etc. fixes
ok jmc
-rw-r--r-- | bin/pax/pax.1 | 364 |
1 files changed, 162 insertions, 202 deletions
diff --git a/bin/pax/pax.1 b/bin/pax/pax.1 index 657848a601f..d173dd72704 100644 --- a/bin/pax/pax.1 +++ b/bin/pax/pax.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pax.1,v 1.44 2004/02/19 19:15:32 jmc Exp $ +.\" $OpenBSD: pax.1,v 1.45 2005/06/02 16:27:08 jaredy Exp $ .\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $ .\" .\" Copyright (c) 1992 Keith Muller. @@ -41,147 +41,60 @@ .Nm pax .Nd read and write file archives and copy directory hierarchies .Sh SYNOPSIS -.Nm pax -.Op Fl 0cdnvz .Bk -words +.Nm pax +.Op Fl 0cdOnvz +.Op Fl E Ar limit .Op Fl f Ar archive -.Ek -.Bk -words +.Op Fl G Ar group .Op Fl s Ar replstr -.Ar ... -.Ek -.Bk -words +.Op Fl T Ar range .Op Fl U Ar user -.Ar ... -.Ek -.Bk -words -.Op Fl G Ar group -.Ar ... -.Ek -.Bk -words -.Oo -.Fl T -.Op Ar from_date -.Op Ar ,to_date -.Oc -.Ar ... -.Ek .Op Ar pattern ... .Nm pax .Fl r -.Op Fl cdiknuvzDYZ -.Bk -words +.Op Fl 0cDdikOnuvYZz +.Op Fl E Ar limit .Op Fl f Ar archive -.Ek -.Bk -words +.Op Fl G Ar group .Op Fl o Ar options -.Ar ... -.Ek -.Bk -words .Op Fl p Ar string -.Ar ... -.Ek -.Bk -words .Op Fl s Ar replstr -.Ar ... -.Ek -.Op Fl E Ar limit -.Bk -words +.Op Fl T Ar range .Op Fl U Ar user -.Ar ... -.Ek -.Bk -words -.Op Fl G Ar group -.Ar ... -.Ek -.Bk -words -.Oo -.Fl T -.Op Ar from_date -.Op Ar ,to_date -.Oc -.Ar ... -.Ek .Op Ar pattern ... .Nm pax .Fl w -.Op Fl 0dituvzHLPX -.Bk -words +.Op Fl 0adHiLOPtuvXz +.Op Fl B Ar bytes .Op Fl b Ar blocksize -.Ek -.Oo -.Op Fl a .Op Fl f Ar archive -.Oc -.Bk -words -.Op Fl x Ar format -.Ek -.Bk -words -.Op Fl s Ar replstr -.Ar ... -.Ek -.Bk -words +.Op Fl G Ar group .Op Fl o Ar options -.Ar ... -.Ek -.Bk -words +.Op Fl s Ar replstr +.Op Fl T Ar range .Op Fl U Ar user -.Ar ... -.Ek -.Bk -words -.Op Fl G Ar group -.Ar ... -.Ek -.Bk -words -.Op Fl B Ar bytes -.Ek -.Bk -words -.Oo -.Fl T -.Op Ar from_date -.Op Ar ,to_date -.Op Ar /[c][m] -.Oc -.Ar ... -.Ek +.Op Fl x Ar format .Op Ar file ... .Nm pax .Fl r .Fl w -.Op Fl 0diklntuvDHLPXYZ -.Bk -words +.Op Fl 0DdHikLlnOPtuvXYZ +.Op Fl E Ar limit +.Op Fl G Ar group .Op Fl p Ar string -.Ar ... -.Ek -.Bk -words .Op Fl s Ar replstr -.Ar ... -.Ek -.Bk -words +.Op Fl T Ar range .Op Fl U Ar user -.Ar ... -.Ek -.Bk -words -.Op Fl G Ar group -.Ar ... -.Ek -.Bk -words -.Oo -.Fl T -.Op Ar from_date -.Op Ar ,to_date -.Op Ar /[c][m] -.Oc -.Ar ... -.Ek .Op Ar file ... .Ar directory +.Ek .Sh DESCRIPTION .Nm -will read, write, and list the members of an archive file, +will read, write, and list the members of an archive file and will copy directory hierarchies. .Nm -operation is independent of the specific archive format, +operation is independent of the specific archive format and supports a wide variety of different archive formats. A list of supported archive formats can be found under the description of the .Fl x @@ -198,13 +111,14 @@ will operate under: and .Em copy . .Bl -tag -width 6n -.It <none> +.It \*(Ltnone\*(Gt .Em List . .Nm will write to standard output a table of contents of the members of the archive file read from standard input, whose pathnames match the specified -.Ar patterns . +.Ar pattern +arguments. The table of contents contains one filename per line and is written using single line buffering. .It Fl r @@ -212,7 +126,8 @@ and is written using single line buffering. .Nm extracts the members of the archive file read from the standard input, with pathnames matching the specified -.Ar patterns . +.Ar pattern +arguments. The archive format and blocking is automatically determined on input. When an extracted file is a directory, the entire file hierarchy rooted at that directory is extracted. @@ -259,7 +174,7 @@ the original and the copied files (see the .Fl l option below). .Pp -.Em Warning : +.Sy Warning : The destination .Ar directory must not be one of the @@ -298,7 +213,7 @@ The operand is used to select one or more pathnames of archive members. Archive members are selected using the pattern matching notation described by -.Xr fnmatch 3 . +.Xr glob 3 . When the .Ar pattern operand is not supplied, all members of the archive will be selected. @@ -332,7 +247,8 @@ The options are as follows: .It Fl r Read an archive file from standard input and extract the specified -.Ar files . +.Ar file +operands. If any intermediate directories are needed in order to extract an archive member, these directories will be created as if .Xr mkdir 2 @@ -358,8 +274,9 @@ is read for a list of pathnames with one per line without any leading or trailing .Aq blanks . .It Fl a -Append -.Ar files +Append the given +.Ar file +operands to the end of an archive that was previously written. If an archive format is not specified with a .Fl x @@ -372,7 +289,7 @@ with a non-zero exit status. The blocking size used in the archive volume where writing starts will continue to be used for the remainder of that archive volume. .Pp -.Em Warning : +.Sy Warning : Many storage devices are not able to support the operations necessary to perform an append operation. Any attempt to append to an archive stored on such a device may damage the @@ -483,7 +400,7 @@ cannot be opened for reading and writing. Do not overwrite existing files. .It Fl l (The lowercase letter -.Dq ell. ) +.Dq ell . ) Link files. In the .Em copy @@ -509,6 +426,17 @@ In general, .Ar options take the form: .Ar name Ns = Ns Ar value . +.Pp +The following options are available for the old +.Bx +.Em tar +format: +.Pp +.Bl -tag -width Ds -compact +.It Cm nodir +.It Cm write_opt=nodir +When writing archives, omit the storage of directories. +.El .It Fl p Ar string Specify one or more file characteristic options (privileges). The @@ -529,7 +457,7 @@ The meanings of the specification characters are as follows: Do not preserve file access times. By default, file access times are preserved whenever possible. .It Cm e -.Sq Preserve everything , +.Dq Preserve everything , the user ID, group ID, file mode bits, file access time, and file modification time. This is intended to be used by @@ -549,7 +477,7 @@ By default, file modification times are preserved whenever possible. .It Cm o Preserve the user ID and group ID. .It Cm p -.Sq Preserve +.Dq Preserve the file mode bits. This is intended to be used by a .Em user @@ -589,34 +517,40 @@ If the file characteristic letters in any of the string option-arguments are duplicated or conflict with each other, the one(s) given last will take precedence. For example, if -.Dl Fl p Ar eme +.Fl p Ar eme is specified, file modification times are still preserved. .It Fl s Ar replstr -Modify the file or archive member names specified by the -.Ar pattern -or -.Ar file -operands according to the substitution expression +Modify the archive member names according to the substitution expression .Ar replstr , using the syntax of the .Xr ed 1 utility regular expressions. +.Ar file +or +.Ar pattern +arguments may be given to restrict the list of archive members to those +specified. +.Pp The format of these regular expressions is: +.Pp .Dl /old/new/[gp] +.Pp As in .Xr ed 1 , -.Cm old -is a basic regular expression and -.Cm new +.Ar old +is a basic regular expression (see +.Xr re_format 7 ) +and +.Ar new can contain an ampersand .Pq Ql & , -.Ql \en +.Ql \e Ns Em n (where -.Ar n +.Em n is a digit) back-references, or subexpression matching. The -.Cm old +.Ar old string may also contain newline characters. Any non-null character can be used as a delimiter .Po @@ -628,6 +562,7 @@ Multiple expressions can be specified. The expressions are applied in the order they are specified on the command line, terminating with the first successful substitution. +.Pp The optional trailing .Cm g continues to apply the substitution expression to the pathname substring, @@ -640,7 +575,9 @@ The optional trailing .Cm p will cause the final result of a successful substitution to be written to standard error in the following format: -.Dl <original pathname> >> <new pathname> +.Pp +.D1 Em original-pathname No >> Em new-pathname +.Pp File or archive member names that substitute to the empty string are not selected and will be skipped. .It Fl t @@ -674,16 +611,22 @@ utility with the option. For pathnames representing a hard link to a previous member of the archive, the output has the format: -.Dl <ls -l listing> == <link name> +.Pp +.Dl Em ls -l listing Li == Em link-name +.Pp 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 +.Pp +.Dl Em ls -l listing Li =\*(Gt Em link-name +.Pp +Where +.Em ls -l listing +is the output format specified by the .Xr ls 1 utility when used with the .Fl l option. Otherwise for all the other operational modes -.Po Em read , write , Li and Em copy +.Po Em read , write , No and Em copy .Pc , pathnames are written and flushed to standard error without a trailing newline @@ -693,11 +636,11 @@ The trailing newline is not buffered and is written only after the file has been read or written. .It Fl x Ar format Specify the output archive format, with the default format being -.Ar ustar . +.Cm ustar . .Nm currently supports the following formats: .Bl -tag -width "sv4cpio" -.It Ar cpio +.It Cm cpio The extended cpio interchange format specified in the .St -p1003.2 standard. @@ -706,7 +649,7 @@ Inode and device information about a file (used for detecting file hard links by this format), which may be truncated by this format, is detected by .Nm and is repaired. -.It Ar bcpio +.It Cm bcpio The 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 formats @@ -715,22 +658,25 @@ Inode and device information about a file (used for detecting file hard links by this format), which may be truncated by this format, is detected by .Nm and is repaired. -.It Ar sv4cpio +.It Cm sv4cpio The 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 links by this format), which may be truncated by this format, is detected by .Nm and is repaired. -.It Ar sv4crc -The System V release 4 cpio with file crc checksums. +.It Cm sv4crc +The 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 links by this format), which may be truncated by this format, is detected by .Nm and is repaired. -.It Ar tar -The old BSD tar format as found in BSD4.3. +.It Cm tar +The old +.Bx +tar format as found in +.Bx 4.3 . The default blocksize for this format is 10240 bytes. Pathnames stored by this format must be 100 characters or less in length. Only @@ -744,8 +690,9 @@ For backwards compatibility with even older tar formats, a .Fl o option can be used when writing an archive to omit the storage of directories. This option takes the form: +.Pp .Dl Fl o Cm write_opt=nodir -.It Ar ustar +.It Cm ustar The extended tar interchange format specified in the .St -p1003.2 standard. @@ -833,7 +780,7 @@ Select a file based on its .Ar group name, or when starting with a .Cm # , -a numeric gid. +a numeric GID. A .Ql \e can be used to escape the @@ -856,13 +803,23 @@ automated tasks where error recovery cannot be performed by a human. .It Fl P Do 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]] +.It Fl T Ar range Allow files to be selected based on a file modification or inode change -time falling within a specified time range of +time falling within the specified time range. +The range has the format: +.Sm off +.Bd -filled -offset indent +.Oo Ar from_date Oc Oo , +.Ar to_date Oc Oo / +.Oo Cm c Oc Op Cm m Oc +.Ed +.Sm on +.Pp +The dates specified by .Ar from_date to .Ar to_date -(the dates are inclusive). +are inclusive. If only a .Ar from_date is supplied, all files with a modification or inode change time @@ -885,22 +842,22 @@ is in the or .Em copy mode, the optional trailing field -.Ar [c][m] +.Oo Cm c Oc Op Cm m can be used to determine which file time (inode change, file modification or both) are used in the comparison. If neither is specified, the default is to use file modification time only. The -.Ar m +.Cm m specifies the comparison of file modification time (the time when the file was last written). The -.Ar c +.Cm c specifies the comparison of inode change time (the time when the file inode was last changed; e.g., a change of owner, group, mode, etc). When -.Ar c +.Cm c and -.Ar m +.Cm m are both specified, then the modification and inode change times are both compared. The inode change time comparison is useful in selecting files whose @@ -916,42 +873,43 @@ changed during a specified time range will be archived). A time range is made up of six different fields and each field must contain two digits. The format is: +.Pp .Dl [[[[[cc]yy]mm]dd]HH]MM[.SS] +.Pp Where -.Cm cc +.Ar cc is the first two digits of the year (the century), -.Cm yy +.Ar yy is the last two digits of the year, the first -.Cm mm +.Ar mm is the month (from 01 to 12), -.Cm dd +.Ar dd is the day of the month (from 01 to 31), -.Cm HH +.Ar HH is the hour of the day (from 00 to 23), -.Cm MM +.Ar MM is the minute (from 00 to 59), and -.Cm SS +.Ar SS is the seconds (from 00 to 59). The minute field -.Cm MM +.Ar MM is required, while the other fields are optional and must be added in the following order: -.br -.Cm \& HH , dd , mm , -.Cm yy , cc . -.br +.Ar HH , dd , mm , +.Ar yy , cc . +.Pp The -.Cm SS +.Ar SS field may be added independently of the other fields. Time ranges are relative to the current time, so -.Dl Fl T Ar 1234/cm +.Ic -T 1234/cm would select all files with a modification or inode change time of 12:34 PM today or later. Multiple .Fl T -time range can be supplied and checking stops with the first match. +time range can be supplied, and checking stops with the first match. .It Fl U Ar user Select a file based on its .Ar user @@ -1076,40 +1034,39 @@ than the file to which it is compared. Path in which to store temporary files. .El .Sh EXAMPLES -.Li $ pax -w -f /dev/rst0 \&. -.Pp -Copies the contents of the current directory to the device -.Pa /dev/rst0 . +Copy the contents of the current directory to the device +.Pa /dev/rst0 : .Pp -.Li $ pax -v -f filename +.Dl $ pax -w -f /dev/rst0 \&. .Pp -Gives the verbose table of contents for an archive stored in -.Pa filename . +Give the verbose table of contents for an archive stored in +.Pa filename : .Pp -.Li $ mkdir newdir ; -.Li cd olddir ; -.Li pax -rw \&. newdir +.Dl $ pax -v -f filename .Pp This sequence of commands will copy the entire .Pa olddir directory hierarchy to -.Pa newdir . +.Pa newdir : +.Bd -literal -offset indent +$ mkdir newdir +$ cd olddir +$ pax -rw . newdir +.Ed .Pp -.Li $ pax -r -s ',^//*usr//*,,' -f a.pax -.Pp -Reads the archive +Read the archive .Pa a.pax , with all files rooted in .Pa /usr -into the archive extracted relative to the current directory. +into the archive extracted relative to the current directory: .Pp -.Li $ pax -rw -i \&. dest_dir +.Dl $ pax -r -s ',^//*usr//*,,' -f a.pax .Pp -Can be used to interactively select the files to copy from the current -directory to -.Pa dest_dir . +This can be used to interactively select the files to copy from the +current directory to +.Pa dest_dir : .Pp -.Li "$ pax -r -pe -U root -G bin -f a.pax" +.Dl $ pax -rw -i \&. dest_dir .Pp Extract all files from the archive .Pa a.pax @@ -1117,19 +1074,21 @@ which are owned by .Em root with group .Em bin -and preserve all file permissions. +and preserve all file permissions: .Pp -.Li "$ pax -r -w -v -Y -Z home /backup" +.Dl "$ pax -r -pe -U root -G bin -f a.pax" .Pp Update (and list) only those files in the destination directory .Pa /backup which are older (less recent inode change or file modification times) than files with the same name found in the source file tree -.Pa home . +.Pa home : +.Pp +.Dl "$ pax -r -w -v -Y -Z home /backup" .Sh DIAGNOSTICS .Nm will exit with one of the following values: -.Bl -tag -width 2n +.Bl -tag -width 2n -offset indent .It 0 All files were processed successfully. .It 1 @@ -1181,6 +1140,7 @@ utility is a superset of the .St -p1003.2 standard. The options +.Fl 0 , .Fl B , .Fl D , .Fl E , @@ -1194,14 +1154,14 @@ The options .Fl Y , .Fl Z , the archive formats -.Ar bcpio , -.Ar sv4cpio , -.Ar sv4crc , -.Ar tar , +.Em bcpio , +.Em sv4cpio , +.Em sv4crc , +.Em tar , and the flawed archive handling during -.Ar list +.Em list and -.Ar read +.Em read operations are extensions to the .Tn POSIX standard. |