ZIPINFO(1L) ZIPINFO(1L)NAMEzipinfo - list detailed information about a ZIP archiveSYNOPSISzipinfo [-12smlvhMtTz] file[.zip] [file(s) ...][-x xfile(s) ...]unzip -Z [-12smlvhMtTz] file[.zip] [file(s) ...][-x xfile(s) ...]DESCRIPTIONzipinfo lists technical information about files in a ZIParchive, most commonly found on MS-DOS systems. Suchinformation includes file access permissions, encryptionstatus, type of compression, version and operating systemor file system of compressing program, and the like. Thedefault behavior (with no options) is to list single-lineentries for each file in the archive, with header andtrailer lines providing summary information for the entirearchive. The format is a cross between Unix ``ls -l'' and``unzip -v'' output. See DETAILED DESCRIPTION below.Note that zipinfo is the same program as unzip (underUnix, a link to it); on some systems, however, zipinfosupport may have been omitted when unzip was compiled.ARGUMENTSfile[.zip]Path of the ZIP archive(s). If the file specifica-tion is a wildcard, each matching file is processedin an order determined by the operating system (orfile system). Only the filename can be a wildcard;the path itself cannot. Wildcard expressions aresimilar to Unix egrep(1) (regular) expressions andmay contain:* matches a sequence of 0 or more characters? matches exactly 1 character[...] matches any single character found insidethe brackets; ranges are specified by abeginning character, a hyphen, and an endingcharacter. If an exclamation point or acaret (`!' or `^') follows the left bracket,then the range of characters within thebrackets is complemented (that is, anythingexcept the characters inside the brackets isconsidered a match).(Be sure to quote any character that might other-wise be interpreted or modified by the operatingsystem, particularly under Unix and VMS.) If nomatches are found, the specification is assumed tobe a literal filename; and if that also fails, theInfo-ZIP 17 February 2002 (v2.4) 1ZIPINFO(1L) ZIPINFO(1L)suffix .zip is appended. Note that self-extractingZIP files are supported; just specify the .exe suf-fix (if any) explicitly.[file(s)]An optional list of archive members to be pro-cessed. Regular expressions (wildcards) may beused to match multiple members; see above. Again,be sure to quote expressions that would otherwisebe expanded or modified by the operating system.[-x xfile(s)]An optional list of archive members to be excludedfrom processing.OPTIONS-1 list filenames only, one per line. This optionexcludes all others; headers, trailers and zipfilecomments are never printed. It is intended for usein Unix shell scripts.-2 list filenames only, one per line, but allow head-ers (-h), trailers (-t) and zipfile comments (-z),as well. This option may be useful in cases wherethe stored filenames are particularly long.-s list zipfile info in short Unix ``ls -l'' format.This is the default behavior; see below.-m list zipfile info in medium Unix ``ls -l'' format.Identical to the -s output, except that the com-pression factor, expressed as a percentage, is alsolisted.-l list zipfile info in long Unix ``ls -l'' format.As with -m except that the compressed size (inbytes) is printed instead of the compression ratio.-v list zipfile information in verbose, multi-pageformat.-h list header line. The archive name, actual size(in bytes) and total number of files is printed.-M pipe all output through an internal pager similarto the Unix more(1) command. At the end of ascreenful of output, zipinfo pauses with a``--More--'' prompt; the next screenful may beviewed by pressing the Enter (Return) key or thespace bar. zipinfo can be terminated by pressingthe ``q'' key and, on some systems, theEnter/Return key. Unlike Unix more(1), there is noforward-searching or editing capability. Also,zipinfo doesn't notice if long lines wrap at theInfo-ZIP 17 February 2002 (v2.4) 2ZIPINFO(1L) ZIPINFO(1L)edge of the screen, effectively resulting in theprinting of two or more lines and the likelihoodthat some text will scroll off the top of thescreen before being viewed. On some systems thenumber of available lines on the screen is notdetected, in which case zipinfo assumes the heightis 24 lines.-t list totals for files listed or for all files. Thenumber of files listed, their uncompressed and com-pressed total sizes, and their overall compressionfactor is printed; or, if only the totals line isbeing printed, the values for the entire archiveare given. Note that the total compressed (data)size will never match the actual zipfile size,since the latter includes all of the internal zip-file headers in addition to the compressed data.-T print the file dates and times in a sortable deci-mal format (yymmdd.hhmmss). The default date for-mat is a more standard, human-readable version withabbreviated month names (see examples below).-z include the archive comment (if any) in the list-ing.DETAILED DESCRIPTIONzipinfo has a number of modes, and its behavior can berather difficult to fathom if one isn't familiar with Unixls(1) (or even if one is). The default behavior is tolist files in the following format:-rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660The last three fields are the modification date and timeof the file, and its name. The case of the filename isrespected; thus files that come from MS-DOS PKZIP arealways capitalized. If the file was zipped with a storeddirectory name, that is also displayed as part of thefilename.The second and third fields indicate that the file waszipped under Unix with version 1.9 of zip. Since it comesfrom Unix, the file permissions at the beginning of theline are printed in Unix format. The uncompressed file-size (2802 in this example) is the fourth field.The fifth field consists of two characters, either ofwhich may take on several values. The first character maybe either `t' or `b', indicating that zip believes thefile to be text or binary, respectively; but if the fileis encrypted, zipinfo notes this fact by capitalizing thecharacter (`T' or `B'). The second character may alsotake on four values, depending on whether there is anInfo-ZIP 17 February 2002 (v2.4) 3ZIPINFO(1L) ZIPINFO(1L)extended local header and/or an ``extra field'' associatedwith the file (fully explained in PKWare's APPNOTE.TXT,but basically analogous to pragmas in ANSI C--i.e., theyprovide a standard way to include non-standard informationin the archive). If neither exists, the character will bea hyphen (`-'); if there is an extended local header butno extra field, `l'; if the reverse, `x'; and if bothexist, `X'. Thus the file in this example is (probably) atext file, is not encrypted, and has neither an extrafield nor an extended local header associated with it.The example below, on the other hand, is an encryptedbinary file with an extra field:RWD,R,R 0.9 vms 168 Bx shrk 9-Aug-91 19:15 perms.0644Extra fields are used for various purposes (see discussionof the -v option below) including the storage of VMS fileattributes, which is presumably the case here. Note thatthe file attributes are listed in VMS format. Some otherpossibilities for the host operating system (which isactually a misnomer--host file system is more correct)include OS/2 or NT with High Performance File System(HPFS), MS-DOS, OS/2 or NT with File Allocation Table(FAT) file system, and Macintosh. These are denoted asfollows:-rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs-r--ahs 1.1 fat 4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF--w------- 1.0 mac 17357 bx i8:2 4-May-92 04:02 unzip.macrFile attributes in the first two cases are indicated in aUnix-like format, where the seven subfields indicatewhether the file: (1) is a directory, (2) is readable(always true), (3) is writable, (4) is executable (guessedon the basis of the extension--.exe, .com, .bat, .cmd and.btm files are assumed to be so), (5) has its archive bitset, (6) is hidden, and (7) is a system file. Interpreta-tion of Macintosh file attributes is unreliable becausesome Macintosh archivers don't store any attributes in thearchive.Finally, the sixth field indicates the compression methodand possible sub-method used. There are six methods knownat present: storing (no compression), reducing, shrink-ing, imploding, tokenizing (never publicly released), anddeflating. In addition, there are four levels of reducing(1 through 4); four types of imploding (4K or 8K slidingdictionary, and 2 or 3 Shannon-Fano trees); and four lev-els of deflating (superfast, fast, normal, maximum com-pression). zipinfo represents these methods and theirsub-methods as follows: stor; re:1, re:2, etc.; shrk;i4:2, i8:3, etc.; tokn; and defS, defF, defN, and defX.The medium and long listings are almost identical to theInfo-ZIP 17 February 2002 (v2.4) 4ZIPINFO(1L) ZIPINFO(1L)short format except that they add information on thefile's compression. The medium format lists the file'scompression factor as a percentage indicating the amountof space that has been ``removed'':-rw-rws--- 1.5 unx 2802 t- 81% defX 11-Aug-91 13:48 perms.2660In this example, the file has been compressed by more thana factor of five; the compressed data are only 19% of theoriginal size. The long format gives the compressedfile's size in bytes, instead:-rw-rws--- 1.5 unx 2802 t- 538 defX 11-Aug-91 13:48 perms.2660Adding the -T option changes the file date and time todecimal format:-rw-rws--- 1.5 unx 2802 t- 538 defX 910811.134804 perms.2660Note that because of limitations in the MS-DOS format usedto store file times, the seconds field is always roundedto the nearest even second. For Unix files this isexpected to change in the next major releases of zip(1L)and unzip.In addition to individual file information, a default zip-file listing also includes header and trailer lines:Archive: OS2.zip 5453 bytes 5 files,,rw, 1.0 hpf 730 b- i4:3 26-Jun-92 23:40 Contents,,rw, 1.0 hpf 3710 b- i4:3 26-Jun-92 23:33 makefile.os2,,rw, 1.0 hpf 8753 b- i8:3 26-Jun-92 15:29 os2unzip.c,,rw, 1.0 hpf 98 b- stor 21-Aug-91 15:34 unzip.def,,rw, 1.0 hpf 95 b- stor 21-Aug-91 17:51 zipinfo.def5 files, 13386 bytes uncompressed, 4951 bytes compressed: 63.0%The header line gives the name of the archive, its totalsize, and the total number of files; the trailer gives thenumber of files listed, their total uncompressed size, andtheir total compressed size (not including any of zip'sinternal overhead). If, however, one or more file(s) areprovided, the header and trailer lines are not listed.This behavior is also similar to that of Unix's ``ls -l'';it may be overridden by specifying the -h and -t optionsexplicitly. In such a case the listing format must alsobe specified explicitly, since -h or -t (or both) in theabsence of other options implies that ONLY the header ortrailer line (or both) is listed. See the EXAMPLES sec-tion below for a semi-intelligible translation of thisnonsense.The verbose listing is mostly self-explanatory. It alsolists file comments and the zipfile comment, if any, andthe type and number of bytes in any stored extra fields.Info-ZIP 17 February 2002 (v2.4) 5ZIPINFO(1L) ZIPINFO(1L)Currently known types of extra fields include PKWARE'sauthentication (``AV'') info; OS/2 extended attributes;VMS filesystem info, both PKWARE and Info-ZIP versions;Macintosh resource forks; Acorn/Archimedes SparkFS info;and so on. (Note that in the case of OS/2 extendedattributes--perhaps the most common use of zipfile extrafields--the size of the stored EAs as reported by zipinfomay not match the number given by OS/2's dir command: OS/2always reports the number of bytes required in 16-bit for-mat, whereas zipinfo always reports the 32-bit storage.)ENVIRONMENT OPTIONSModifying zipinfo's default behavior via options placed inan environment variable can be a bit complicated toexplain, due to zipinfo's attempts to handle variousdefaults in an intuitive, yet Unix-like, manner. (Try notto laugh.) Nevertheless, there is some underlying logic.In brief, there are three ``priority levels'' of options:the default options; environment options, which can over-ride or add to the defaults; and explicit options given bythe user, which can override or add to either of theabove.The default listing format, as noted above, correspondsroughly to the "zipinfo -hst" command (except when indi-vidual zipfile members are specified). A user who prefersthe long-listing format (-l) can make use of the zipinfo'senvironment variable to change this default:Unix Bourne shell:ZIPINFO=-l; export ZIPINFOUnix C shell:setenv ZIPINFO -lOS/2 or MS-DOS:set ZIPINFO=-lVMS (quotes for lowercase):define ZIPINFO_OPTS "-l"If, in addition, the user dislikes the trailer line, zip-info's concept of ``negative options'' may be used tooverride the default inclusion of the line. This isaccomplished by preceding the undesired option with one ormore minuses: e.g., ``-l-t'' or ``--tl'', in this exam-ple. The first hyphen is the regular switch character,but the one before the `t' is a minus sign. The dual useof hyphens may seem a little awkward, but it's reasonablyintuitive nonetheless: simply ignore the first hyphen andgo from there. It is also consistent with the behavior ofthe Unix command nice(1).As suggested above, the default variable names areInfo-ZIP 17 February 2002 (v2.4) 6ZIPINFO(1L) ZIPINFO(1L)ZIPINFO_OPTS for VMS (where the symbol used to installzipinfo as a foreign command would otherwise be confusedwith the environment variable), and ZIPINFO for all otheroperating systems. For compatibility with zip(1L), ZIPIN-FOOPT is also accepted (don't ask). If both ZIPINFO andZIPINFOOPT are defined, however, ZIPINFO takes precedence.unzip's diagnostic option (-v with no zipfile name) can beused to check the values of all four possible unzip andzipinfo environment variables.EXAMPLESTo get a basic, short-format listing of the complete con-tents of a ZIP archive storage.zip, with both header andtotals lines, use only the archive name as an argument tozipinfo:zipinfo storageTo produce a basic, long-format listing (not verbose),including header and totals lines, use -l:zipinfo -l storageTo list the complete contents of the archive withoutheader and totals lines, either negate the -h and -toptions or else specify the contents explicitly:zipinfo --h-t storagezipinfo storage \*(where the backslash is required only if the shell wouldotherwise expand the `*' wildcard, as in Unix when glob-bing is turned on--double quotes around the asterisk wouldhave worked as well). To turn off the totals line bydefault, use the environment variable (C shell is assumedhere):setenv ZIPINFO --tzipinfo storageTo get the full, short-format listing of the first exampleagain, given that the environment variable is set as inthe previous example, it is necessary to specify the -soption explicitly, since the -t option by itself impliesthat ONLY the footer line is to be printed:setenv ZIPINFO --tzipinfo -t storage [only totals line]zipinfo -st storage [full listing]The -s option, like -m and -l, includes headers and foot-ers by default, unless otherwise specified. Since theenvironment variable specified no footers and that has ahigher precedence than the default behavior of -s, anInfo-ZIP 17 February 2002 (v2.4) 7ZIPINFO(1L) ZIPINFO(1L)explicit -t option was necessary to produce the full list-ing. Nothing was indicated about the header, however, sothe -s option was sufficient. Note that both the -h and-t options, when used by themselves or with each other,override any default listing of member files; only theheader and/or footer are printed. This behavior is usefulwhen zipinfo is used with a wildcard zipfile specifica-tion; the contents of all zipfiles are then summarizedwith a single command.To list information on a single file within the archive,in medium format, specify the filename explicitly:zipinfo -m storage unshrink.cThe specification of any member file, as in this example,will override the default header and totals lines; onlythe single line of information about the requested filewill be printed. This is intuitively what one wouldexpect when requesting information about a single file.For multiple files, it is often useful to know the totalcompressed and uncompressed size; in such cases -t may bespecified explicitly:zipinfo -mt storage "*.[ch]" Mak\*To get maximal information about the ZIP archive, use theverbose option. It is usually wise to pipe the outputinto a filter such as Unix more(1) if the operating systemallows it:zipinfo -v storage | moreFinally, to see the most recently modified files in thearchive, use the -T option in conjunction with an externalsorting utility such as Unix sort(1) (and tail(1) as well,in this example):zipinfo -T storage | sort -n +6 | tail -15The -n option to sort(1) tells it to sort numericallyrather than in ASCII order, and the +6 option tells it tosort on the sixth field after the first one (i.e., theseventh field). This assumes the default short-listingformat; if -m or -l is used, the proper sort(1) optionwould be +7. The tail(1) command filters out all but thelast 15 lines of the listing. Future releases of zipinfomay incorporate date/time and filename sorting as built-inoptions.TIPSThe author finds it convenient to define an alias ii forzipinfo on systems that allow aliases (or, on other sys-tems, copy/rename the executable, create a link or createInfo-ZIP 17 February 2002 (v2.4) 8ZIPINFO(1L) ZIPINFO(1L)a command file with the name ii). The ii usage parallelsthe common ll alias for long listings in Unix, and thesimilarity between the outputs of the two commands wasintentional.BUGSAs with unzip, zipinfo's -M (``more'') option is overlysimplistic in its handling of screen output; as notedabove, it fails to detect the wrapping of long lines andmay thereby cause lines at the top of the screen to bescrolled off before being read. zipinfo should detect andtreat each occurrence of line-wrap as one additional lineprinted. This requires knowledge of the screen's width aswell as its height. In addition, zipinfo should detectthe true screen geometry on all systems.zipinfo's listing-format behavior is unnecessarily complexand should be simplified. (This is not to say that itwill be.)SEE ALSOls(1), funzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zip-cloak(1L), zipnote(1L), zipsplit(1L)URLThe Info-ZIP home page is currently athttp://www.info-zip.org/pub/infozip/orftp://ftp.info-zip.org/pub/infozip/ .AUTHORGreg ``Cave Newt'' Roelofs. ZipInfo contains pattern-matching code by Mark Adler and fixes/improvements by manyothers. Please refer to the CONTRIBS file in the UnZipsource distribution for a more complete list.Info-ZIP 17 February 2002 (v2.4) 9