2 ZIPINFO(1L) ZIPINFO(1L)
5 zipinfo - list detailed information about a ZIP archive
8 zipinfo [-12smlvhMtTz] file[.zip] [file(s) ...]
11 unzip -Z [-12smlvhMtTz] file[.zip] [file(s) ...]
15 zipinfo lists technical information about files in a ZIP
16 archive, most commonly found on MS-DOS systems. Such
17 information includes file access permissions, encryption
18 status, type of compression, version and operating system
19 or file system of compressing program, and the like. The
20 default behavior (with no options) is to list single-line
21 entries for each file in the archive, with header and
22 trailer lines providing summary information for the entire
23 archive. The format is a cross between Unix ``ls -l'' and
24 ``unzip -v'' output. See DETAILED DESCRIPTION below.
25 Note that zipinfo is the same program as unzip (under
26 Unix, a link to it); on some systems, however, zipinfo
27 support may have been omitted when unzip was compiled.
31 Path of the ZIP archive(s). If the file specifica-
32 tion is a wildcard, each matching file is processed
33 in an order determined by the operating system (or
34 file system). Only the filename can be a wildcard;
35 the path itself cannot. Wildcard expressions are
36 similar to Unix egrep(1) (regular) expressions and
39 * matches a sequence of 0 or more characters
41 ? matches exactly 1 character
43 [...] matches any single character found inside
44 the brackets; ranges are specified by a
45 beginning character, a hyphen, and an ending
46 character. If an exclamation point or a
47 caret (`!' or `^') follows the left bracket,
48 then the range of characters within the
49 brackets is complemented (that is, anything
50 except the characters inside the brackets is
53 (Be sure to quote any character that might other-
54 wise be interpreted or modified by the operating
55 system, particularly under Unix and VMS.) If no
56 matches are found, the specification is assumed to
57 be a literal filename; and if that also fails, the
59 Info-ZIP 17 February 2002 (v2.4) 1
61 ZIPINFO(1L) ZIPINFO(1L)
63 suffix .zip is appended. Note that self-extracting
64 ZIP files are supported; just specify the .exe suf-
65 fix (if any) explicitly.
68 An optional list of archive members to be pro-
69 cessed. Regular expressions (wildcards) may be
70 used to match multiple members; see above. Again,
71 be sure to quote expressions that would otherwise
72 be expanded or modified by the operating system.
75 An optional list of archive members to be excluded
79 -1 list filenames only, one per line. This option
80 excludes all others; headers, trailers and zipfile
81 comments are never printed. It is intended for use
82 in Unix shell scripts.
84 -2 list filenames only, one per line, but allow head-
85 ers (-h), trailers (-t) and zipfile comments (-z),
86 as well. This option may be useful in cases where
87 the stored filenames are particularly long.
89 -s list zipfile info in short Unix ``ls -l'' format.
90 This is the default behavior; see below.
92 -m list zipfile info in medium Unix ``ls -l'' format.
93 Identical to the -s output, except that the com-
94 pression factor, expressed as a percentage, is also
97 -l list zipfile info in long Unix ``ls -l'' format.
98 As with -m except that the compressed size (in
99 bytes) is printed instead of the compression ratio.
101 -v list zipfile information in verbose, multi-page
104 -h list header line. The archive name, actual size
105 (in bytes) and total number of files is printed.
107 -M pipe all output through an internal pager similar
108 to the Unix more(1) command. At the end of a
109 screenful of output, zipinfo pauses with a
110 ``--More--'' prompt; the next screenful may be
111 viewed by pressing the Enter (Return) key or the
112 space bar. zipinfo can be terminated by pressing
113 the ``q'' key and, on some systems, the
114 Enter/Return key. Unlike Unix more(1), there is no
115 forward-searching or editing capability. Also,
116 zipinfo doesn't notice if long lines wrap at the
118 Info-ZIP 17 February 2002 (v2.4) 2
120 ZIPINFO(1L) ZIPINFO(1L)
122 edge of the screen, effectively resulting in the
123 printing of two or more lines and the likelihood
124 that some text will scroll off the top of the
125 screen before being viewed. On some systems the
126 number of available lines on the screen is not
127 detected, in which case zipinfo assumes the height
130 -t list totals for files listed or for all files. The
131 number of files listed, their uncompressed and com-
132 pressed total sizes, and their overall compression
133 factor is printed; or, if only the totals line is
134 being printed, the values for the entire archive
135 are given. Note that the total compressed (data)
136 size will never match the actual zipfile size,
137 since the latter includes all of the internal zip-
138 file headers in addition to the compressed data.
140 -T print the file dates and times in a sortable deci-
141 mal format (yymmdd.hhmmss). The default date for-
142 mat is a more standard, human-readable version with
143 abbreviated month names (see examples below).
145 -z include the archive comment (if any) in the list-
149 zipinfo has a number of modes, and its behavior can be
150 rather difficult to fathom if one isn't familiar with Unix
151 ls(1) (or even if one is). The default behavior is to
152 list files in the following format:
154 -rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660
156 The last three fields are the modification date and time
157 of the file, and its name. The case of the filename is
158 respected; thus files that come from MS-DOS PKZIP are
159 always capitalized. If the file was zipped with a stored
160 directory name, that is also displayed as part of the
163 The second and third fields indicate that the file was
164 zipped under Unix with version 1.9 of zip. Since it comes
165 from Unix, the file permissions at the beginning of the
166 line are printed in Unix format. The uncompressed file-
167 size (2802 in this example) is the fourth field.
169 The fifth field consists of two characters, either of
170 which may take on several values. The first character may
171 be either `t' or `b', indicating that zip believes the
172 file to be text or binary, respectively; but if the file
173 is encrypted, zipinfo notes this fact by capitalizing the
174 character (`T' or `B'). The second character may also
175 take on four values, depending on whether there is an
177 Info-ZIP 17 February 2002 (v2.4) 3
179 ZIPINFO(1L) ZIPINFO(1L)
181 extended local header and/or an ``extra field'' associated
182 with the file (fully explained in PKWare's APPNOTE.TXT,
183 but basically analogous to pragmas in ANSI C--i.e., they
184 provide a standard way to include non-standard information
185 in the archive). If neither exists, the character will be
186 a hyphen (`-'); if there is an extended local header but
187 no extra field, `l'; if the reverse, `x'; and if both
188 exist, `X'. Thus the file in this example is (probably) a
189 text file, is not encrypted, and has neither an extra
190 field nor an extended local header associated with it.
191 The example below, on the other hand, is an encrypted
192 binary file with an extra field:
194 RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644
196 Extra fields are used for various purposes (see discussion
197 of the -v option below) including the storage of VMS file
198 attributes, which is presumably the case here. Note that
199 the file attributes are listed in VMS format. Some other
200 possibilities for the host operating system (which is
201 actually a misnomer--host file system is more correct)
202 include OS/2 or NT with High Performance File System
203 (HPFS), MS-DOS, OS/2 or NT with File Allocation Table
204 (FAT) file system, and Macintosh. These are denoted as
207 -rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs
208 -r--ahs 1.1 fat 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF
209 --w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macr
211 File attributes in the first two cases are indicated in a
212 Unix-like format, where the seven subfields indicate
213 whether the file: (1) is a directory, (2) is readable
214 (always true), (3) is writable, (4) is executable (guessed
215 on the basis of the extension--.exe, .com, .bat, .cmd and
216 .btm files are assumed to be so), (5) has its archive bit
217 set, (6) is hidden, and (7) is a system file. Interpreta-
218 tion of Macintosh file attributes is unreliable because
219 some Macintosh archivers don't store any attributes in the
222 Finally, the sixth field indicates the compression method
223 and possible sub-method used. There are six methods known
224 at present: storing (no compression), reducing, shrink-
225 ing, imploding, tokenizing (never publicly released), and
226 deflating. In addition, there are four levels of reducing
227 (1 through 4); four types of imploding (4K or 8K sliding
228 dictionary, and 2 or 3 Shannon-Fano trees); and four lev-
229 els of deflating (superfast, fast, normal, maximum com-
230 pression). zipinfo represents these methods and their
231 sub-methods as follows: stor; re:1, re:2, etc.; shrk;
232 i4:2, i8:3, etc.; tokn; and defS, defF, defN, and defX.
234 The medium and long listings are almost identical to the
236 Info-ZIP 17 February 2002 (v2.4) 4
238 ZIPINFO(1L) ZIPINFO(1L)
240 short format except that they add information on the
241 file's compression. The medium format lists the file's
242 compression factor as a percentage indicating the amount
243 of space that has been ``removed'':
245 -rw-rws--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660
247 In this example, the file has been compressed by more than
248 a factor of five; the compressed data are only 19% of the
249 original size. The long format gives the compressed
250 file's size in bytes, instead:
252 -rw-rws--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660
254 Adding the -T option changes the file date and time to
257 -rw-rws--- 1.5 unx 2802 t- 538 defX 910811.134804 perms.2660
259 Note that because of limitations in the MS-DOS format used
260 to store file times, the seconds field is always rounded
261 to the nearest even second. For Unix files this is
262 expected to change in the next major releases of zip(1L)
265 In addition to individual file information, a default zip-
266 file listing also includes header and trailer lines:
268 Archive: OS2.zip 5453 bytes 5 files
269 ,,rw, 1.0 hpf 730 b- i4:3 26-Jun-92 23:40 Contents
270 ,,rw, 1.0 hpf 3710 b- i4:3 26-Jun-92 23:33 makefile.os2
271 ,,rw, 1.0 hpf 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c
272 ,,rw, 1.0 hpf 98 b- stor 21-Aug-91 15:34 unzip.def
273 ,,rw, 1.0 hpf 95 b- stor 21-Aug-91 17:51 zipinfo.def
274 5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63.0%
276 The header line gives the name of the archive, its total
277 size, and the total number of files; the trailer gives the
278 number of files listed, their total uncompressed size, and
279 their total compressed size (not including any of zip's
280 internal overhead). If, however, one or more file(s) are
281 provided, the header and trailer lines are not listed.
282 This behavior is also similar to that of Unix's ``ls -l'';
283 it may be overridden by specifying the -h and -t options
284 explicitly. In such a case the listing format must also
285 be specified explicitly, since -h or -t (or both) in the
286 absence of other options implies that ONLY the header or
287 trailer line (or both) is listed. See the EXAMPLES sec-
288 tion below for a semi-intelligible translation of this
291 The verbose listing is mostly self-explanatory. It also
292 lists file comments and the zipfile comment, if any, and
293 the type and number of bytes in any stored extra fields.
295 Info-ZIP 17 February 2002 (v2.4) 5
297 ZIPINFO(1L) ZIPINFO(1L)
299 Currently known types of extra fields include PKWARE's
300 authentication (``AV'') info; OS/2 extended attributes;
301 VMS filesystem info, both PKWARE and Info-ZIP versions;
302 Macintosh resource forks; Acorn/Archimedes SparkFS info;
303 and so on. (Note that in the case of OS/2 extended
304 attributes--perhaps the most common use of zipfile extra
305 fields--the size of the stored EAs as reported by zipinfo
306 may not match the number given by OS/2's dir command: OS/2
307 always reports the number of bytes required in 16-bit for-
308 mat, whereas zipinfo always reports the 32-bit storage.)
311 Modifying zipinfo's default behavior via options placed in
312 an environment variable can be a bit complicated to
313 explain, due to zipinfo's attempts to handle various
314 defaults in an intuitive, yet Unix-like, manner. (Try not
315 to laugh.) Nevertheless, there is some underlying logic.
316 In brief, there are three ``priority levels'' of options:
317 the default options; environment options, which can over-
318 ride or add to the defaults; and explicit options given by
319 the user, which can override or add to either of the
322 The default listing format, as noted above, corresponds
323 roughly to the "zipinfo -hst" command (except when indi-
324 vidual zipfile members are specified). A user who prefers
325 the long-listing format (-l) can make use of the zipinfo's
326 environment variable to change this default:
329 ZIPINFO=-l; export ZIPINFO
337 VMS (quotes for lowercase):
338 define ZIPINFO_OPTS "-l"
340 If, in addition, the user dislikes the trailer line, zip-
341 info's concept of ``negative options'' may be used to
342 override the default inclusion of the line. This is
343 accomplished by preceding the undesired option with one or
344 more minuses: e.g., ``-l-t'' or ``--tl'', in this exam-
345 ple. The first hyphen is the regular switch character,
346 but the one before the `t' is a minus sign. The dual use
347 of hyphens may seem a little awkward, but it's reasonably
348 intuitive nonetheless: simply ignore the first hyphen and
349 go from there. It is also consistent with the behavior of
350 the Unix command nice(1).
352 As suggested above, the default variable names are
354 Info-ZIP 17 February 2002 (v2.4) 6
356 ZIPINFO(1L) ZIPINFO(1L)
358 ZIPINFO_OPTS for VMS (where the symbol used to install
359 zipinfo as a foreign command would otherwise be confused
360 with the environment variable), and ZIPINFO for all other
361 operating systems. For compatibility with zip(1L), ZIPIN-
362 FOOPT is also accepted (don't ask). If both ZIPINFO and
363 ZIPINFOOPT are defined, however, ZIPINFO takes precedence.
364 unzip's diagnostic option (-v with no zipfile name) can be
365 used to check the values of all four possible unzip and
366 zipinfo environment variables.
369 To get a basic, short-format listing of the complete con-
370 tents of a ZIP archive storage.zip, with both header and
371 totals lines, use only the archive name as an argument to
376 To produce a basic, long-format listing (not verbose),
377 including header and totals lines, use -l:
381 To list the complete contents of the archive without
382 header and totals lines, either negate the -h and -t
383 options or else specify the contents explicitly:
385 zipinfo --h-t storage
388 (where the backslash is required only if the shell would
389 otherwise expand the `*' wildcard, as in Unix when glob-
390 bing is turned on--double quotes around the asterisk would
391 have worked as well). To turn off the totals line by
392 default, use the environment variable (C shell is assumed
398 To get the full, short-format listing of the first example
399 again, given that the environment variable is set as in
400 the previous example, it is necessary to specify the -s
401 option explicitly, since the -t option by itself implies
402 that ONLY the footer line is to be printed:
405 zipinfo -t storage [only totals line]
406 zipinfo -st storage [full listing]
408 The -s option, like -m and -l, includes headers and foot-
409 ers by default, unless otherwise specified. Since the
410 environment variable specified no footers and that has a
411 higher precedence than the default behavior of -s, an
413 Info-ZIP 17 February 2002 (v2.4) 7
415 ZIPINFO(1L) ZIPINFO(1L)
417 explicit -t option was necessary to produce the full list-
418 ing. Nothing was indicated about the header, however, so
419 the -s option was sufficient. Note that both the -h and
420 -t options, when used by themselves or with each other,
421 override any default listing of member files; only the
422 header and/or footer are printed. This behavior is useful
423 when zipinfo is used with a wildcard zipfile specifica-
424 tion; the contents of all zipfiles are then summarized
425 with a single command.
427 To list information on a single file within the archive,
428 in medium format, specify the filename explicitly:
430 zipinfo -m storage unshrink.c
432 The specification of any member file, as in this example,
433 will override the default header and totals lines; only
434 the single line of information about the requested file
435 will be printed. This is intuitively what one would
436 expect when requesting information about a single file.
437 For multiple files, it is often useful to know the total
438 compressed and uncompressed size; in such cases -t may be
439 specified explicitly:
441 zipinfo -mt storage "*.[ch]" Mak\*
443 To get maximal information about the ZIP archive, use the
444 verbose option. It is usually wise to pipe the output
445 into a filter such as Unix more(1) if the operating system
448 zipinfo -v storage | more
450 Finally, to see the most recently modified files in the
451 archive, use the -T option in conjunction with an external
452 sorting utility such as Unix sort(1) (and tail(1) as well,
455 zipinfo -T storage | sort -n +6 | tail -15
457 The -n option to sort(1) tells it to sort numerically
458 rather than in ASCII order, and the +6 option tells it to
459 sort on the sixth field after the first one (i.e., the
460 seventh field). This assumes the default short-listing
461 format; if -m or -l is used, the proper sort(1) option
462 would be +7. The tail(1) command filters out all but the
463 last 15 lines of the listing. Future releases of zipinfo
464 may incorporate date/time and filename sorting as built-in
468 The author finds it convenient to define an alias ii for
469 zipinfo on systems that allow aliases (or, on other sys-
470 tems, copy/rename the executable, create a link or create
472 Info-ZIP 17 February 2002 (v2.4) 8
474 ZIPINFO(1L) ZIPINFO(1L)
476 a command file with the name ii). The ii usage parallels
477 the common ll alias for long listings in Unix, and the
478 similarity between the outputs of the two commands was
482 As with unzip, zipinfo's -M (``more'') option is overly
483 simplistic in its handling of screen output; as noted
484 above, it fails to detect the wrapping of long lines and
485 may thereby cause lines at the top of the screen to be
486 scrolled off before being read. zipinfo should detect and
487 treat each occurrence of line-wrap as one additional line
488 printed. This requires knowledge of the screen's width as
489 well as its height. In addition, zipinfo should detect
490 the true screen geometry on all systems.
492 zipinfo's listing-format behavior is unnecessarily complex
493 and should be simplified. (This is not to say that it
497 ls(1), funzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zip-
498 cloak(1L), zipnote(1L), zipsplit(1L)
501 The Info-ZIP home page is currently at
502 http://www.info-zip.org/pub/infozip/
504 ftp://ftp.info-zip.org/pub/infozip/ .
507 Greg ``Cave Newt'' Roelofs. ZipInfo contains pattern-
508 matching code by Mark Adler and fixes/improvements by many
509 others. Please refer to the CONTRIBS file in the UnZip
510 source distribution for a more complete list.
512 Info-ZIP 17 February 2002 (v2.4) 9