Imported upstream version 1.5
[manpages-zh.git] / raw / man1 / zipinfo.1
blobeca6307fe1c2ac2a7026108f412b48c173882fd0
1 .\"  Copyright (c) 1990-2002 Info-ZIP.  All rights reserved.
2 .\"
3 .\"  See the accompanying file LICENSE, version 2000-Apr-09 or later
4 .\"  (the contents of which are also included in unzip.h) for terms of use.
5 .\"  If, for some reason, all these files are missing, the Info-ZIP license
6 .\"  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
7 .\"
8 .\" zipinfo.1 by Greg Roelofs and others.
9 .\"
10 .\" =========================================================================
11 .\" define .X macro (for long-line ZipInfo output examples; small Courier):
12 .de X
13 .nf
14 .ft CW
15 .ie n .ti -5
16 .el \{ .ti +2m
17 .ps -1 \}
18 \&\\$1
19 .ie n .ti +5
20 .el \{ .ti -2m
21 .ps +1 \}
22 .ft
23 .fi
25 .\" define .EX/.EE (for multiline user-command examples; normal Courier font)
26 .de EX
27 .in +4n
28 .nf
29 .ft CW
31 .de EE
32 .ft
33 .fi
34 .in -4n
36 .\" =========================================================================
37 .TH ZIPINFO 1L "17 February 2002 (v2.4)" "Info-ZIP"
38 .SH NAME
39 zipinfo \- list detailed information about a ZIP archive
40 .PD
41 .SH SYNOPSIS
42 \fBzipinfo\fP [\fB\-12smlvhMtTz\fP] \fIfile\fP[\fI.zip\fP]
43 [\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
44 .PP
45 \fBunzip\fP \fB\-Z\fP [\fB\-12smlvhMtTz\fP] \fIfile\fP[\fI.zip\fP]
46 [\fIfile(s)\fP\ .\|.\|.] [\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.]
47 .PD
48 .\" =========================================================================
49 .SH DESCRIPTION
50 \fIzipinfo\fP lists technical information about files in a ZIP archive, most
51 commonly found on MS-DOS systems.  Such information includes file access
52 permissions, encryption status, type of compression, version and operating
53 system or file system of compressing program, and the like.  The default
54 behavior (with no options) is
55 to list single-line entries for each file in the archive, with header and
56 trailer lines providing summary information for the entire archive.  The
57 format is a cross between Unix ``\fCls \-l\fR'' and ``\fCunzip \-v\fR''
58 output.  See
59 .B "DETAILED DESCRIPTION"
60 below.  Note that \fIzipinfo\fP is the same program as \fIunzip\fP (under
61 Unix, a link to it); on some systems, however, \fIzipinfo\fP support may
62 have been omitted when \fIunzip\fP was compiled.
63 .PD
64 .\" =========================================================================
65 .SH ARGUMENTS
66 .TP
67 .IR file [ .zip ]
68 Path of the ZIP archive(s).  If the file specification is a wildcard,
69 each matching file is processed in an order determined by the operating
70 system (or file system).  Only the filename can be a wildcard; the path
71 itself cannot.  Wildcard expressions are similar to Unix \fIegrep\fP(1)
72 (regular) expressions and may contain:
73 .RS
74 .IP *
75 matches a sequence of 0 or more characters
76 .IP ?
77 matches exactly 1 character
78 .IP [.\|.\|.]
79 matches any single character found inside the brackets; ranges are specified
80 by a beginning character, a hyphen, and an ending character.  If an exclamation
81 point or a caret (`!' or `^') follows the left bracket, then the range of
82 characters within the brackets is complemented (that is, anything \fIexcept\fP
83 the characters inside the brackets is considered a match).
84 .RE
85 .IP
86 (Be sure to quote any character that might otherwise be interpreted or
87 modified by the operating system, particularly under Unix and VMS.)  If no
88 matches are found, the specification is assumed to be a literal filename;
89 and if that also fails, the suffix \fC.zip\fR is appended.  Note that
90 self-extracting ZIP files are supported; just specify the \fC.exe\fR suffix
91 (if any) explicitly.
92 .IP [\fIfile(s)\fP]
93 An optional list of archive members to be processed.
94 Regular expressions (wildcards) may be used to match multiple members; see
95 above.  Again, be sure to quote expressions that would otherwise be expanded
96 or modified by the operating system.
97 .IP [\fB\-x\fP\ \fIxfile(s)\fP]
98 An optional list of archive members to be excluded from processing.
99 .\" =========================================================================
100 .SH OPTIONS
102 .B \-1
103 list filenames only, one per line.  This option excludes all others; headers,
104 trailers and zipfile comments are never printed.  It is intended for use in
105 Unix shell scripts.
107 .B \-2
108 list filenames only, one per line, but allow headers (\fB\-h\fP), trailers
109 (\fB\-t\fP) and zipfile comments (\fB\-z\fP), as well.  This option may be
110 useful in cases where the stored filenames are particularly long.
112 .B \-s
113 list zipfile info in short Unix ``\fCls \-l\fR'' format.  This is the default
114 behavior; see below.
116 .B \-m
117 list zipfile info in medium Unix ``\fCls \-l\fR'' format.  Identical to the
118 \fB\-s\fP output, except that the compression factor, expressed as a
119 percentage, is also listed.
121 .B \-l
122 list zipfile info in long Unix ``\fCls \-l\fR'' format.  As with \fB\-m\fP
123 except that the compressed size (in bytes) is printed instead of the
124 compression ratio.
126 .B \-v
127 list zipfile information in verbose, multi-page format.
129 .B \-h
130 list header line.  The archive name, actual size (in bytes) and total number
131 of files is printed.
133 .B \-M
134 pipe all output through an internal pager similar to the Unix \fImore\fP(1)
135 command.  At the end of a screenful of output, \fIzipinfo\fP pauses with a
136 ``\-\-More\-\-'' prompt; the next screenful may be viewed by pressing the
137 Enter (Return) key or the space bar.  \fIzipinfo\fP can be terminated by
138 pressing the ``q'' key and, on some systems, the Enter/Return key.  Unlike
139 Unix \fImore\fP(1), there is no forward-searching or editing capability.
140 Also, \fIzipinfo\fP doesn't notice if long lines wrap at the edge of the
141 screen, effectively resulting in the printing of two or more lines and the
142 likelihood that some text will scroll off the top of the screen before being
143 viewed.  On some systems the number of available lines on the screen is not
144 detected, in which case \fIzipinfo\fP assumes the height is 24 lines.
146 .B \-t
147 list totals for files listed or for all files.  The number of files listed,
148 their uncompressed and compressed total sizes, and their overall compression
149 factor is printed; or, if only the totals line is being printed, the values
150 for the entire archive are given.  Note that the total compressed (data)
151 size will never match the actual zipfile size, since the latter includes all
152 of the internal zipfile headers in addition to the compressed data.
154 .B \-T
155 print the file dates and times in a sortable decimal format (yymmdd.hhmmss).
156 The default date format is a more standard, human-readable version with
157 abbreviated month names (see examples below).
159 .B \-z
160 include the archive comment (if any) in the listing.
162 .\" =========================================================================
163 .SH "DETAILED DESCRIPTION"
164 .I zipinfo
165 has a number of modes, and its behavior can be rather difficult to fathom
166 if one isn't familiar with Unix \fIls\fP(1) (or even if one is).  The default
167 behavior is to list files in the following format:
169 .X "-rw-rws---  1.9 unx    2802 t- defX 11-Aug-91 13:48 perms.2660"
171 The last three fields are the modification date and time of
172 the file, and its name.  The case of the filename is respected; thus
173 files that come from MS-DOS PKZIP are always capitalized.  If the file
174 was zipped with a stored directory name, that is also displayed as part
175 of the filename.
177 The second and third fields indicate that the file was zipped under
178 Unix with version 1.9 of \fIzip\fP.  Since it comes from Unix, the file
179 permissions at the beginning of the line are printed in Unix format.
180 The uncompressed file-size (2802 in this example) is the fourth field.
182 The fifth field consists of two characters, either of which may take
183 on several values.  The first character may be either `t' or `b', indicating
184 that \fIzip\fP believes the file to be text or binary, respectively;
185 but if the file is encrypted, \fIzipinfo\fP
186 notes this fact by capitalizing the character (`T' or `B').  The second
187 character may also take on four values, depending on whether there is
188 an extended local header and/or an ``extra field'' associated with the
189 file (fully explained in PKWare's APPNOTE.TXT, but basically analogous to
190 pragmas in ANSI C--i.e., they provide a standard way to include non-standard
191 information in the archive).  If neither exists, the character
192 will be a hyphen (`\-'); if there is an extended local header but no extra
193 field, `l'; if the reverse, `x'; and if both exist, `X'.  Thus the
194 file in this example is (probably) a text file, is not encrypted, and
195 has neither an extra field nor an extended local header associated with it.
196 The example below, on the other hand, is an encrypted binary file with an
197 extra field:
199 .X "RWD,R,R     0.9 vms     168 Bx shrk  9-Aug-91 19:15 perms.0644"
201 Extra fields are used for various purposes (see discussion of the \fB\-v\fP
202 option below) including the storage of VMS file attributes, which is
203 presumably the case here.  Note that the file attributes are listed in
204 VMS format.  Some other possibilities for the host operating system (which
205 is actually a misnomer--host file system is more correct) include
206 OS/2 or NT with High Performance File System (HPFS), MS-DOS, OS/2 or NT
207 with File Allocation Table (FAT) file system, and Macintosh.  These are
208 denoted as follows:
210 .X "-rw-a--     1.0 hpf    5358 Tl i4:3  4-Dec-91 11:33 longfilename.hpfs"
211 .X "-r--ahs     1.1 fat    4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF"
212 .X "--w-------  1.0 mac   17357 bx i8:2  4-May-92 04:02 unzip.macr"
214 File attributes in the first two cases are indicated in a Unix-like format,
215 where the seven subfields indicate whether the file:  (1) is a directory,
216 (2) is readable (always true), (3) is writable, (4) is executable (guessed
217 on the basis of the extension--\fI.exe\fP, \fI.com\fP, \fI.bat\fP, \fI.cmd\fP
218 and \fI.btm\fP files are assumed to be so), (5) has its archive bit set,
219 (6) is hidden, and (7) is a system file.  Interpretation of Macintosh file
220 attributes is unreliable because some Macintosh archivers don't store any
221 attributes in the archive.
223 Finally, the sixth field indicates
224 the compression method and possible sub-method used.  There are six methods
225 known at present:  storing (no compression), reducing, shrinking, imploding,
226 tokenizing (never publicly released), and deflating.  In addition, there are
227 four levels of reducing (1 through 4); four types of imploding (4K or 8K
228 sliding dictionary, and 2 or 3 Shannon-Fano trees); and four levels of
229 deflating (superfast, fast, normal, maximum compression).  \fIzipinfo\fP
230 represents these methods and their sub-methods as follows:  \fIstor\fP;
231 \fIre:1\fP, \fIre:2\fP, etc.; \fIshrk\fP; \fIi4:2\fP, \fIi8:3\fP, etc.;
232 \fItokn\fP; and \fIdefS\fP, \fIdefF\fP, \fIdefN\fP, and \fIdefX\fP.
234 The medium and long listings are almost identical to the short format except
235 that they add information on the file's compression.  The medium format lists
236 the file's compression factor as a percentage indicating the amount of space
237 that has been ``removed'':
239 .X "-rw-rws---  1.5 unx    2802 t- 81% defX 11-Aug-91 13:48 perms.2660"
241 In this example, the file has been compressed by more than a factor of
242 five; the compressed data are only 19% of the original size.  The long
243 format gives the compressed file's size in bytes, instead:
245 .X "-rw-rws---  1.5 unx    2802 t-     538 defX 11-Aug-91 13:48 perms.2660"
247 Adding the \fB\-T\fP option changes the file date and time to decimal
248 format:
250 .X "-rw-rws---  1.5 unx    2802 t-     538 defX 910811.134804 perms.2660"
252 Note that because of limitations in the MS-DOS format used to store file
253 times, the seconds field is always rounded to the nearest even second.
254 For Unix files this is expected to change in the next major releases of
255 \fIzip\fP(1L) and \fIunzip\fP.
257 In addition to individual file information, a default zipfile listing
258 also includes header and trailer lines:
260 .X "Archive:  OS2.zip   5453 bytes   5 files"
261 .X ",,rw,       1.0 hpf     730 b- i4:3 26-Jun-92 23:40 Contents"
262 .X ",,rw,       1.0 hpf    3710 b- i4:3 26-Jun-92 23:33 makefile.os2"
263 .X ",,rw,       1.0 hpf    8753 b- i8:3 26-Jun-92 15:29 os2unzip.c"
264 .X ",,rw,       1.0 hpf      98 b- stor 21-Aug-91 15:34 unzip.def"
265 .X ",,rw,       1.0 hpf      95 b- stor 21-Aug-91 17:51 zipinfo.def"
266 .X "5 files, 13386 bytes uncompressed, 4951 bytes compressed:  63.0%"
268 The header line gives the name of the archive, its total size, and the
269 total number of files; the trailer gives the number of files listed,
270 their total uncompressed size, and their total compressed size (not
271 including any of \fIzip\fP's internal overhead).  If, however, one or
272 more \fIfile(s)\fP are provided, the header and trailer lines are
273 not listed.  This behavior is also similar to that of Unix's ``\fCls \-l\fR'';
274 it may be overridden by specifying the \fB\-h\fP and \fB\-t\fP options
275 explicitly.
276 In such a case the listing format must also be specified explicitly,
277 since \fB\-h\fP or \fB\-t\fP (or both) in the absence of other options implies
278 that ONLY the header or trailer line (or both) is listed.  See the
279 \fBEXAMPLES\fP section below for a semi-intelligible translation of this
280 nonsense.
282 The verbose listing is mostly self-explanatory.  It also lists file
283 comments and the zipfile comment, if any, and the type and number of bytes
284 in any stored extra fields.  Currently known types of extra fields include
285 PKWARE's authentication (``AV'') info; OS/2 extended attributes; VMS
286 filesystem info, both PKWARE and Info-ZIP versions; Macintosh resource
287 forks; Acorn/Archimedes SparkFS info; and so on.  (Note
288 that in the case of OS/2 extended attributes--perhaps the most common
289 use of zipfile extra fields--the size of the stored EAs as reported by
290 \fIzipinfo\fP may not match the number given by OS/2's \fIdir\fP command:
291 OS/2 always reports the number of bytes required in 16-bit format, whereas
292 \fIzipinfo\fP always reports the 32-bit storage.)
294 .\" =========================================================================
295 .SH "ENVIRONMENT OPTIONS"
296 Modifying \fIzipinfo\fP's default behavior via options placed in
297 an environment variable can be a bit complicated to explain, due to
298 \fIzipinfo\fP's attempts to handle various defaults in an intuitive,
299 yet Unix-like, manner.  (Try not to laugh.)  Nevertheless, there is some
300 underlying logic.  In brief,
301 there are three ``priority levels'' of options:  the default options;
302 environment options, which can override or add to the defaults; and
303 explicit options given by the user, which can override or add to
304 either of the above.
306 The default listing format, as noted above, corresponds roughly
307 to the "\fCzipinfo \-hst\fR" command (except when individual zipfile members
308 are specified).
309 A user who prefers the long-listing format (\fB\-l\fP) can make use of the
310 \fIzipinfo\fP's environment variable to change this default:
312 Unix Bourne shell:
313 \f(CW\&ZIPINFO=\-l; export ZIPINFO\fP
315 Unix C shell:
316 \f(CW\&setenv ZIPINFO \-l\fP
318 OS/2 or MS-DOS:
319 \f(CW\&set ZIPINFO=\-l\fP
321 VMS (quotes for \fIlowercase\fP):
322 \f(CW\&define ZIPINFO_OPTS "\-l"\fP
325 If, in addition, the user dislikes the trailer line, \fIzipinfo\fP's
326 concept of ``negative options'' may be used to override the default
327 inclusion of the line.  This is accomplished by preceding the undesired
328 option with one or more minuses:  e.g., ``\fC\-l\-t\fR'' or ``\fC\-\-tl\fR'',
329 in this example.  The first hyphen is the regular switch character, but the
330 one before the `t' is a minus sign.  The dual use of hyphens may seem a
331 little awkward, but it's reasonably intuitive nonetheless:  simply ignore
332 the first hyphen and go from there.  It is also consistent with the behavior
333 of the Unix command \fInice\fP(1).
335 As suggested above, the default variable names are ZIPINFO_OPTS for VMS
336 (where the symbol used to install \fIzipinfo\fP as a foreign command
337 would otherwise be confused with the environment variable), and ZIPINFO
338 for all other operating systems.  For compatibility with \fIzip\fP(1L),
339 ZIPINFOOPT is also accepted (don't ask).  If both ZIPINFO and ZIPINFOOPT
340 are defined, however, ZIPINFO takes precedence.  \fIunzip\fP's diagnostic
341 option (\fB\-v\fP with no zipfile name) can be used to check the values
342 of all four possible \fIunzip\fP and \fIzipinfo\fP environment variables.
344 .\" =========================================================================
345 .SH EXAMPLES
346 To get a basic, short-format listing of the complete contents of a ZIP
347 archive \fIstorage.zip\fP, with both header and totals lines, use only
348 the archive name as an argument to zipinfo:
351 zipinfo storage
354 To produce a basic, long-format listing (not verbose), including header and
355 totals lines, use \fB\-l\fP:
358 zipinfo \-l storage
361 To list the complete contents of the archive without header and totals
362 lines, either negate the \fB\-h\fP and \fB\-t\fP options or else specify the
363 contents explicitly:
366 zipinfo \-\-h\-t storage
367 zipinfo storage \e*
370 (where the backslash is required only if the shell would otherwise expand
371 the `*' wildcard, as in Unix when globbing is turned on--double quotes around
372 the asterisk would have worked as well).  To turn off the totals line by
373 default, use the environment variable (C shell is assumed here):
376 setenv ZIPINFO \-\-t
377 zipinfo storage
380 To get the full, short-format listing of the first example again, given
381 that the environment variable is set as in the previous example, it is
382 necessary to specify the \fB\-s\fP option explicitly, since the \fB\-t\fP
383 option by itself implies that ONLY the footer line is to be printed:
386 setenv ZIPINFO \-\-t
387 zipinfo \-t storage            \fR[only totals line]\fP
388 zipinfo \-st storage           \fR[full listing]\fP
391 The \fB\-s\fP option, like \fB\-m\fP and \fB\-l\fP, includes headers and
392 footers by default, unless otherwise specified.  Since the environment
393 variable specified no footers and that has a higher precedence than the
394 default behavior of \fB\-s\fP, an explicit \fB\-t\fP option was necessary
395 to produce the full listing.  Nothing was indicated about the header,
396 however, so the \fB\-s\fP option was sufficient.  Note that both the
397 \fB\-h\fP and \fB\-t\fP options, when used by themselves or with
398 each other, override any default listing of member files; only the header
399 and/or footer are printed.  This behavior is useful when \fIzipinfo\fP is
400 used with a wildcard zipfile specification; the contents of all zipfiles
401 are then summarized with a single command.
403 To list information on a single file within the archive, in medium format,
404 specify the filename explicitly:
407 zipinfo \-m storage unshrink.c
410 The specification of any member file, as in this example, will override
411 the default header and totals lines; only the single line of information
412 about the requested file will be printed.  This is intuitively what one
413 would expect when requesting information about a single file.  For multiple
414 files, it is often useful to know the total compressed and uncompressed
415 size; in such cases \fB\-t\fP may be specified explicitly:
418 zipinfo \-mt storage "*.[ch]" Mak\e*
421 To get maximal information about the ZIP archive, use the verbose
422 option.  It is usually wise to pipe the output into a filter such as
423 Unix \fImore\fP(1) if the operating system allows it:
426 zipinfo \-v storage | more
429 Finally, to see the most recently modified files in the archive, use
430 the \fB\-T\fP option in conjunction with an external sorting utility
431 such as Unix \fIsort\fP(1) (and \fItail\fP(1) as well, in this example):
434 zipinfo \-T storage | sort -n +6 | tail -15
437 The \fB\-n\fP option to \fIsort\fP(1) tells it to sort numerically
438 rather than in ASCII order, and the \fB\+6\fP option tells it to sort
439 on the sixth field after the first one (i.e., the seventh field).  This
440 assumes the default short-listing format; if \fB\-m\fP or \fB\-l\fP is
441 used, the proper \fIsort\fP(1) option would be \fB\+7\fP.  The \fItail\fP(1)
442 command filters out all but the last 15 lines of the listing.  Future
443 releases of \fIzipinfo\fP may incorporate date/time and filename sorting
444 as built-in options.
446 .\" =========================================================================
447 .SH TIPS
448 The author finds it convenient to define an alias \fIii\fP for \fIzipinfo\fP
449 on systems that allow aliases (or, on other systems, copy/rename the
450 executable, create a link or create a command file with the name \fIii\fP).
451 The \fIii\fP usage parallels the common \fIll\fP alias for long listings in
452 Unix, and the similarity between the outputs of the two commands was
453 intentional.
455 .\" =========================================================================
456 .SH BUGS
457 As with \fIunzip\fP, \fIzipinfo\fP's \fB\-M\fP (``more'') option is overly
458 simplistic in its handling of screen output; as noted above, it fails to detect
459 the wrapping of long lines and may thereby cause lines at the top of the screen
460 to be scrolled off before being read.  \fIzipinfo\fP should detect and treat
461 each occurrence of line-wrap as one additional line printed.  This requires
462 knowledge of the screen's width as well as its height.  In addition,
463 \fIzipinfo\fP should detect the true screen geometry on all systems.
465 \fIzipinfo\fP's listing-format behavior is unnecessarily complex and should
466 be simplified.  (This is not to say that it will be.)
468 .\" =========================================================================
469 .SH "SEE ALSO"
470 \fIls\fP(1), \fIfunzip\fP(1L), \fIunzip\fP(1L), \fIunzipsfx\fP(1L),
471 \fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
473 .\" =========================================================================
474 .SH URL
475 The Info-ZIP home page is currently at
477 \fChttp://www.info-zip.org/pub/infozip/\fR
481 \fCftp://ftp.info-zip.org/pub/infozip/\fR .
484 .\" =========================================================================
485 .SH AUTHOR
486 Greg ``Cave Newt'' Roelofs.  ZipInfo contains pattern-matching code
487 by Mark Adler and fixes/improvements by many others.  Please refer to the
488 CONTRIBS file in the UnZip source distribution for a more complete list.