1UNZIP(1L) UNZIP(1L)
2
3
4
6 unzip - list, test and extract compressed files in a ZIP archive
7
9 unzip [-Z] [-cflptTuvz[abjnoqsCKLMVWX$/:]] file[.zip] [file(s) ...]
10 [-x xfile(s) ...] [-d exdir]
11
13 unzip will list, test, or extract files from a ZIP archive, commonly
14 found on MS-DOS systems. The default behavior (with no options) is to
15 extract into the current directory (and subdirectories below it) all
16 files from the specified ZIP archive. A companion program, zip(1L),
17 creates ZIP archives; both programs are compatible with archives cre‐
18 ated by PKWARE's PKZIP and PKUNZIP for MS-DOS, but in many cases the
19 program options or default behaviors differ.
20
22 file[.zip]
23 Path of the ZIP archive(s). If the file specification is a
24 wildcard, each matching file is processed in an order determined
25 by the operating system (or file system). Only the filename can
26 be a wildcard; the path itself cannot. Wildcard expressions are
27 similar to those supported in commonly used Unix shells (sh,
28 ksh, csh) and may contain:
29
30 * matches a sequence of 0 or more characters
31
32 ? matches exactly 1 character
33
34 [...] matches any single character found inside the brackets;
35 ranges are specified by a beginning character, a hyphen,
36 and an ending character. If an exclamation point or a
37 caret (`!' or `^') follows the left bracket, then the
38 range of characters within the brackets is complemented
39 (that is, anything except the characters inside the
40 brackets is considered a match). To specify a verbatim
41 left bracket, the three-character sequence ``[[]'' has to
42 be used.
43
44 (Be sure to quote any character that might otherwise be inter‐
45 preted or modified by the operating system, particularly under
46 Unix and VMS.) If no matches are found, the specification is
47 assumed to be a literal filename; and if that also fails, the
48 suffix .zip is appended. Note that self-extracting ZIP files
49 are supported, as with any other ZIP archive; just specify the
50 .exe suffix (if any) explicitly.
51
52 [file(s)]
53 An optional list of archive members to be processed, separated
54 by spaces. (VMS versions compiled with VMSCLI defined must
55 delimit files with commas instead. See -v in OPTIONS below.)
56 Regular expressions (wildcards) may be used to match multiple
57 members; see above. Again, be sure to quote expressions that
58 would otherwise be expanded or modified by the operating system.
59
60 [-x xfile(s)]
61 An optional list of archive members to be excluded from process‐
62 ing. Since wildcard characters normally match (`/') directory
63 separators (for exeptions see the option -W, this option may be
64 used to exclude any files that are in subdirectories. For exam‐
65 ple, ``unzip foo *.[ch] -x */*'' would extract all C source
66 files in the main directory, but none in any subdirectories.
67 Without the -x option, all C source files in all directories
68 within the zipfile would be extracted.
69
70 [-d exdir]
71 An optional directory to which to extract files. By default,
72 all files and subdirectories are recreated in the current direc‐
73 tory; the -d option allows extraction in an arbitrary directory
74 (always assuming one has permission to write to the directory).
75 This option need not appear at the end of the command line; it
76 is also accepted before the zipfile specification (with the nor‐
77 mal options), immediately after the zipfile specification, or
78 between the file(s) and the -x option. The option and directory
79 may be concatenated without any white space between them, but
80 note that this may cause normal shell behavior to be suppressed.
81 In particular, ``-d ~'' (tilde) is expanded by Unix C shells
82 into the name of the user's home directory, but ``-d~'' is
83 treated as a literal subdirectory ``~'' of the current direc‐
84 tory.
85
87 Note that, in order to support obsolescent hardware, unzip's usage
88 screen is limited to 22 or 23 lines and should therefore be considered
89 only a reminder of the basic unzip syntax rather than an exhaustive
90 list of all possible flags. The exhaustive list follows:
91
92 -Z [22mzipinfo(1L) mode. If the first option on the command line is
93 -Z, the remaining options are taken to be zipinfo(1L) options.
94 See the appropriate manual page for a description of these
95 options.
96
97 -A [OS/2, Unix DLL] print extended help for the DLL's programming
98 interface (API).
99
100 -c extract files to stdout/screen (``CRT''). This option is simi‐
101 lar to the -p option except that the name of each file is
102 printed as it is extracted, the -a option is allowed, and ASCII-
103 EBCDIC conversion is automatically performed if appropriate.
104 This option is not listed in the unzip usage screen.
105
106 -f freshen existing files, i.e., extract only those files that
107 already exist on disk and that are newer than the disk copies.
108 By default unzip queries before overwriting, but the -o option
109 may be used to suppress the queries. Note that under many oper‐
110 ating systems, the TZ (timezone) environment variable must be
111 set correctly in order for -f and -u to work properly (under
112 Unix the variable is usually set automatically). The reasons
113 for this are somewhat subtle but have to do with the differences
114 between DOS-format file times (always local time) and Unix-for‐
115 mat times (always in GMT/UTC) and the necessity to compare the
116 two. A typical TZ value is ``PST8PDT'' (US Pacific time with
117 automatic adjustment for Daylight Savings Time or ``summer
118 time'').
119
120 -l list archive files (short format). The names, uncompressed file
121 sizes and modification dates and times of the specified files
122 are printed, along with totals for all files specified. If
123 UnZip was compiled with OS2_EAS defined, the -l option also
124 lists columns for the sizes of stored OS/2 extended attributes
125 (EAs) and OS/2 access control lists (ACLs). In addition, the
126 zipfile comment and individual file comments (if any) are dis‐
127 played. If a file was archived from a single-case file system
128 (for example, the old MS-DOS FAT file system) and the -L option
129 was given, the filename is converted to lowercase and is pre‐
130 fixed with a caret (^).
131
132 -p extract files to pipe (stdout). Nothing but the file data is
133 sent to stdout, and the files are always extracted in binary
134 format, just as they are stored (no conversions).
135
136 -t test archive files. This option extracts each specified file in
137 memory and compares the CRC (cyclic redundancy check, an
138 enhanced checksum) of the expanded file with the original file's
139 stored CRC value.
140
141 -T [most OSes] set the timestamp on the archive(s) to that of the
142 newest file in each one. This corresponds to zip's -go option
143 except that it can be used on wildcard zipfiles (e.g., ``unzip
144 -T \*.zip'') and is much faster.
145
146 -u update existing files and create new ones if needed. This
147 option performs the same function as the -f option, extracting
148 (with query) files that are newer than those with the same name
149 on disk, and in addition it extracts those files that do not
150 already exist on disk. See -f above for information on setting
151 the timezone properly.
152
153 -v be verbose or print diagnostic version info. This option has
154 evolved and now behaves as both an option and a modifier. As an
155 option it has two purposes: when a zipfile is specified with no
156 other options, -v lists archive files verbosely, adding to the
157 basic -l info the compression method, compressed size, compres‐
158 sion ratio and 32-bit CRC. In contrast to most of the competing
159 utilities, unzip removes the 12 additional header bytes of
160 encrypted entries from the compressed size numbers. Therefore,
161 compressed size and compression ratio figures are independent of
162 the entry's encryption status and show the correct compression
163 performance. (The complete size of the encryped compressed data
164 stream for zipfile entries is reported by the more verbose zip‐
165 info(1L) reports, see the separate manual.) When no zipfile is
166 specified (that is, the complete command is simply ``unzip
167 -v''), a diagnostic screen is printed. In addition to the nor‐
168 mal header with release date and version, unzip lists the home
169 Info-ZIP ftp site and where to find a list of other ftp and non-
170 ftp sites; the target operating system for which it was com‐
171 piled, as well as (possibly) the hardware on which it was com‐
172 piled, the compiler and version used, and the compilation date;
173 any special compilation options that might affect the program's
174 operation (see also DECRYPTION below); and any options stored in
175 environment variables that might do the same (see ENVIRONMENT
176 OPTIONS below). As a modifier it works in conjunction with
177 other options (e.g., -t) to produce more verbose or debugging
178 output; this is not yet fully implemented but will be in future
179 releases.
180
181 -z display only the archive comment.
182
184 -a convert text files. Ordinarily all files are extracted exactly
185 as they are stored (as ``binary'' files). The -a option causes
186 files identified by zip as text files (those with the `t' label
187 in zipinfo listings, rather than `b') to be automatically
188 extracted as such, converting line endings, end-of-file charac‐
189 ters and the character set itself as necessary. (For example,
190 Unix files use line feeds (LFs) for end-of-line (EOL) and have
191 no end-of-file (EOF) marker; Macintoshes use carriage returns
192 (CRs) for EOLs; and most PC operating systems use CR+LF for EOLs
193 and control-Z for EOF. In addition, IBM mainframes and the
194 Michigan Terminal System use EBCDIC rather than the more common
195 ASCII character set, and NT supports Unicode.) Note that zip's
196 identification of text files is by no means perfect; some
197 ``text'' files may actually be binary and vice versa. unzip
198 therefore prints ``[text]'' or ``[binary]'' as a visual check
199 for each file it extracts when using the -a option. The -aa
200 option forces all files to be extracted as text, regardless of
201 the supposed file type.
202
203 -b [general] treat all files as binary (no text conversions). This
204 is a shortcut for ---a.
205
206 -b [Tandem] force the creation files with filecode type 180 ('C')
207 when extracting Zip entries marked as "text". (On Tandem, -a is
208 enabled by default, see above).
209
210 -b [VMS] auto-convert binary files (see -a above) to fixed-length,
211 512-byte record format. Doubling the option (-bb) forces all
212 files to be extracted in this format. When extracting to stan‐
213 dard output (-c or -p option in effect), the default conversion
214 of text record delimiters is disabled for binary (-b) resp. all
215 (-bb) files.
216
217 -B [Unix only, and only if compiled with UNIXBACKUP defined] save a
218 backup copy of each overwritten file with a tilde appended
219 (e.g., the old copy of ``foo'' is renamed to ``foo~''). This is
220 similar to the default behavior of emacs(1) in many locations.
221
222 -C use case-insensitive matching for the selection of archive
223 entries from the command-line list of extract selection pat‐
224 terns. unzip's philosophy is ``you get what you ask for'' (this
225 is also responsible for the -L/-U change; see the relevant
226 options below). Because some file systems are fully case-sensi‐
227 tive (notably those under the Unix operating system) and because
228 both ZIP archives and unzip itself are portable across plat‐
229 forms, unzip's default behavior is to match both wildcard and
230 literal filenames case-sensitively. That is, specifying ``make‐
231 file'' on the command line will only match ``makefile'' in the
232 archive, not ``Makefile'' or ``MAKEFILE'' (and similarly for
233 wildcard specifications). Since this does not correspond to the
234 behavior of many other operating/file systems (for example, OS/2
235 HPFS, which preserves mixed case but is not sensitive to it),
236 the -C option may be used to force all filename matches to be
237 case-insensitive. In the example above, all three files would
238 then match ``makefile'' (or ``make*'', or similar). The -C
239 option affects file specs in both the normal file list and the
240 excluded-file list (xlist).
241
242 Please note that the -L option does neither affect the search
243 for the zipfile(s) nor the matching of archive entries to exist‐
244 ing files on the extraction path. On a case-sensitive file sys‐
245 tem, unzip will never try to overwrite a file ``FOO'' when
246 extracting an entry ``foo''!
247
248 -E [MacOS only] display contents of MacOS extra field during
249 restore operation.
250
251 -F [Acorn only] suppress removal of NFS filetype extension from
252 stored filenames.
253
254 -F [non-Acorn systems supporting long filenames with embedded com‐
255 mas, and only if compiled with ACORN_FTYPE_NFS defined] trans‐
256 late filetype information from ACORN RISC OS extra field blocks
257 into a NFS filetype extension and append it to the names of the
258 extracted files. (When the stored filename appears to already
259 have an appended NFS filetype extension, it is replaced by the
260 info from the extra field.)
261
262 -i [MacOS only] ignore filenames stored in MacOS extra fields.
263 Instead, the most compatible filename stored in the generic part
264 of the entry's header is used.
265
266 -j junk paths. The archive's directory structure is not recreated;
267 all files are deposited in the extraction directory (by default,
268 the current one).
269
270 -J [BeOS only] junk file attributes. The file's BeOS file
271 attributes are not restored, just the file's data.
272
273 -J [MacOS only] ignore MacOS extra fields. All Macintosh specific
274 info is skipped. Data-fork and resource-fork are restored as
275 separate files.
276
277 -K [AtheOS, BeOS, Unix only] retain SUID/SGID/Tacky file
278 attributes. Without this flag, these attribute bits are cleared
279 for security reasons.
280
281 -L convert to lowercase any filename originating on an uppercase-
282 only operating system or file system. (This was unzip's default
283 behavior in releases prior to 5.11; the new default behavior is
284 identical to the old behavior with the -U option, which is now
285 obsolete and will be removed in a future release.) Depending on
286 the archiver, files archived under single-case file systems
287 (VMS, old MS-DOS FAT, etc.) may be stored as all-uppercase
288 names; this can be ugly or inconvenient when extracting to a
289 case-preserving file system such as OS/2 HPFS or a case-sensi‐
290 tive one such as under Unix. By default unzip lists and
291 extracts such filenames exactly as they're stored (excepting
292 truncation, conversion of unsupported characters, etc.); this
293 option causes the names of all files from certain systems to be
294 converted to lowercase. The -LL option forces conversion of
295 every filename to lowercase, regardless of the originating file
296 system.
297
298 -M pipe all output through an internal pager similar to the Unix
299 more(1) command. At the end of a screenful of output, unzip
300 pauses with a ``--More--'' prompt; the next screenful may be
301 viewed by pressing the Enter (Return) key or the space bar.
302 unzip can be terminated by pressing the ``q'' key and, on some
303 systems, the Enter/Return key. Unlike Unix more(1), there is no
304 forward-searching or editing capability. Also, unzip doesn't
305 notice if long lines wrap at the edge of the screen, effectively
306 resulting in the printing of two or more lines and the likeli‐
307 hood that some text will scroll off the top of the screen before
308 being viewed. On some systems the number of available lines on
309 the screen is not detected, in which case unzip assumes the
310 height is 24 lines.
311
312 -n never overwrite existing files. If a file already exists, skip
313 the extraction of that file without prompting. By default unzip
314 queries before extracting any file that already exists; the user
315 may choose to overwrite only the current file, overwrite all
316 files, skip extraction of the current file, skip extraction of
317 all existing files, or rename the current file.
318
319 -N [Amiga] extract file comments as Amiga filenotes. File comments
320 are created with the -c option of zip(1L), or with the -N option
321 of the Amiga port of zip(1L), which stores filenotes as com‐
322 ments.
323
324 -o overwrite existing files without prompting. This is a dangerous
325 option, so use it with care. (It is often used with -f, how‐
326 ever, and is the only way to overwrite directory EAs under
327 OS/2.)
328
329 -P password
330 use password to decrypt encrypted zipfile entries (if any).
331 THIS IS INSECURE! Many multi-user operating systems provide
332 ways for any user to see the current command line of any other
333 user; even on stand-alone systems there is always the threat of
334 over-the-shoulder peeking. Storing the plaintext password as
335 part of a command line in an automated script is even worse.
336 Whenever possible, use the non-echoing, interactive prompt to
337 enter passwords. (And where security is truly important, use
338 strong encryption such as Pretty Good Privacy instead of the
339 relatively weak encryption provided by standard zipfile utili‐
340 ties.)
341
342 -q perform operations quietly (-qq = even quieter). Ordinarily
343 unzip prints the names of the files it's extracting or testing,
344 the extraction methods, any file or zipfile comments that may be
345 stored in the archive, and possibly a summary when finished with
346 each archive. The -q[q] options suppress the printing of some
347 or all of these messages.
348
349 -s [OS/2, NT, MS-DOS] convert spaces in filenames to underscores.
350 Since all PC operating systems allow spaces in filenames, unzip
351 by default extracts filenames with spaces intact (e.g.,
352 ``EA DATA. SF''). This can be awkward, however, since MS-DOS in
353 particular does not gracefully support spaces in filenames.
354 Conversion of spaces to underscores can eliminate the awkward‐
355 ness in some cases.
356
357 -U (obsolete; to be removed in a future release) leave filenames
358 uppercase if created under MS-DOS, VMS, etc. See -L above.
359
360 -V retain (VMS) file version numbers. VMS files can be stored with
361 a version number, in the format file.ext;##. By default the
362 ``;##'' version numbers are stripped, but this option allows
363 them to be retained. (On file systems that limit filenames to
364 particularly short lengths, the version numbers may be truncated
365 or stripped regardless of this option.)
366
367 -W [only when WILD_STOP_AT_DIR compile-time option enabled] modi‐
368 fies the pattern matching routine so that both `?' (single-char
369 wildcard) and `*' (multi-char wildcard) do not match the direc‐
370 tory separator character `/'. (The two-character sequence
371 ``**'' acts as a multi-char wildcard that includes the directory
372 separator in its matched characters.) Examples:
373
374 "*.c" matches "foo.c" but not "mydir/foo.c"
375 "**.c" matches both "foo.c" and "mydir/foo.c"
376 "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
377 "??*/*" matches "ab/foo" and "abc/foo"
378 but not "a/foo" or "a/b/foo"
379
380 This modified behaviour is equivalent to the pattern matching
381 style used by the shells of some of UnZip's supported target OSs
382 (one example is Acorn RISC OS). This option may not be avail‐
383 able on systems where the Zip archive's interal directory sepa‐
384 rator character `/' is allowed as regular character in native
385 operating system filenames. (Currently, UnZip uses the same
386 pattern matching rules for both wildcard zipfile specifications
387 and zip entry selection patterns in most ports. For systems
388 allowing `/' as regular filename character, the -W option would
389 not work as expected on a wildcard zipfile specification.)
390
391 -X [VMS, Unix, OS/2, NT] restore owner/protection info (UICs) under
392 VMS, or user and group info (UID/GID) under Unix, or access con‐
393 trol lists (ACLs) under certain network-enabled versions of OS/2
394 (Warp Server with IBM LAN Server/Requester 3.0 to 5.0; Warp Con‐
395 nect with IBM Peer 1.0), or security ACLs under Windows NT. In
396 most cases this will require special system privileges, and dou‐
397 bling the option (-XX) under NT instructs unzip to use privi‐
398 leges for extraction; but under Unix, for example, a user who
399 belongs to several groups can restore files owned by any of
400 those groups, as long as the user IDs match his or her own.
401 Note that ordinary file attributes are always restored--this
402 option applies only to optional, extra ownership info available
403 on some operating systems. [NT's access control lists do not
404 appear to be especially compatible with OS/2's, so no attempt is
405 made at cross-platform portability of access privileges. It is
406 not clear under what conditions this would ever be useful any‐
407 way.]
408
409 -$ [MS-DOS, OS/2, NT] restore the volume label if the extraction
410 medium is removable (e.g., a diskette). Doubling the option
411 (-$$) allows fixed media (hard disks) to be labelled as well.
412 By default, volume labels are ignored.
413
414 -/ extensions
415 [Acorn only] overrides the extension list supplied by Unzip$Ext
416 environment variable. During extraction, filename extensions
417 that match one of the items in this extension list are swapped
418 in front of the base name of the extracted file.
419
420 -: [all but Acorn, VM/CMS, MVS, Tandem] allows to extract archive
421 members into locations outside of the current `` extraction root
422 folder''. For security reasons, unzip normally removes ``parent
423 dir'' path components (``../'') from the names of extracted
424 file. This safety feature (new for version 5.50) prevents unzip
425 from accidentally writing files to ``sensitive'' areas outside
426 the active extraction folder tree head. The -: option lets
427 unzip switch back to its previous, more liberal behaviour, to
428 allow exact extraction of (older) archives that used ``../''
429 components to create multiple directory trees at the level of
430 the current extraction folder. This option does not enable
431 writing explicitly to the root directory (``/''). To achieve
432 this, it is necessary to set the extraction target folder to
433 root (e.g. -d / ). However, when the -: option is specified, it
434 is still possible to implicitly write to the root directory by
435 specifiying enough ``../'' path components within the zip ar‐
436 chive. Use this option with extreme caution.
437
439 unzip's default behavior may be modified via options placed in an envi‐
440 ronment variable. This can be done with any option, but it is probably
441 most useful with the -a, -L, -C, -q, -o, or -n modifiers: make unzip
442 auto-convert text files by default, make it convert filenames from
443 uppercase systems to lowercase, make it match names case-insensitively,
444 make it quieter, or make it always overwrite or never overwrite files
445 as it extracts them. For example, to make unzip act as quietly as pos‐
446 sible, only reporting errors, one would use one of the following com‐
447 mands:
448
449 Unix Bourne shell:
450 UNZIP=-qq; export UNZIP
451
452 Unix C shell:
453 setenv UNZIP -qq
454
455 OS/2 or MS-DOS:
456 set UNZIP=-qq
457
458 VMS (quotes for lowercase):
459 define UNZIP_OPTS ""-qq""
460
461 Environment options are, in effect, considered to be just like any
462 other command-line options, except that they are effectively the first
463 options on the command line. To override an environment option, one
464 may use the ``minus operator'' to remove it. For instance, to override
465 one of the quiet-flags in the example above, use the command
466
467 unzip --q[other options] zipfile
468
469 The first hyphen is the normal switch character, and the second is a
470 minus sign, acting on the q option. Thus the effect here is to cancel
471 one quantum of quietness. To cancel both quiet flags, two (or more)
472 minuses may be used:
473
474 unzip -t--q zipfile
475 unzip ---qt zipfile
476
477 (the two are equivalent). This may seem awkward or confusing, but it
478 is reasonably intuitive: just ignore the first hyphen and go from
479 there. It is also consistent with the behavior of Unix nice(1).
480
481 As suggested by the examples above, the default variable names are
482 UNZIP_OPTS for VMS (where the symbol used to install unzip as a foreign
483 command would otherwise be confused with the environment variable), and
484 UNZIP for all other operating systems. For compatibility with zip(1L),
485 UNZIPOPT is also accepted (don't ask). If both UNZIP and UNZIPOPT are
486 defined, however, UNZIP takes precedence. unzip's diagnostic option
487 (-v with no zipfile name) can be used to check the values of all four
488 possible unzip and zipinfo environment variables.
489
490 The timezone variable (TZ) should be set according to the local time‐
491 zone in order for the -f and -u to operate correctly. See the descrip‐
492 tion of -f above for details. This variable may also be necessary to
493 get timestamps of extracted files to be set correctly. The WIN32
494 (Win9x/ME/NT4/2K/XP/2K3) port of unzip gets the timezone configuration
495 from the registry, assuming it is correctly set in the Control Panel.
496 The TZ variable is ignored for this port.
497
499 Encrypted archives are fully supported by Info-ZIP software, but due to
500 United States export restrictions, de-/encryption support might be dis‐
501 abled in your compiled binary. However, since spring 2000, US export
502 restrictions have been liberated, and our source archives do now
503 include full crypt code. In case you need binary distributions with
504 crypt support enabled, see the file ``WHERE'' in any Info-ZIP source or
505 binary distribution for locations both inside and outside the US.
506
507 Some compiled versions of unzip may not support decryption. To check a
508 version for crypt support, either attempt to test or extract an
509 encrypted archive, or else check unzip's diagnostic screen (see the -v
510 option above) for ``[decryption]'' as one of the special compilation
511 options.
512
513 As noted above, the -P option may be used to supply a password on the
514 command line, but at a cost in security. The preferred decryption
515 method is simply to extract normally; if a zipfile member is encrypted,
516 unzip will prompt for the password without echoing what is typed.
517 unzip continues to use the same password as long as it appears to be
518 valid, by testing a 12-byte header on each file. The correct password
519 will always check out against the header, but there is a 1-in-256
520 chance that an incorrect password will as well. (This is a security
521 feature of the PKWARE zipfile format; it helps prevent brute-force
522 attacks that might otherwise gain a large speed advantage by testing
523 only the header.) In the case that an incorrect password is given but
524 it passes the header test anyway, either an incorrect CRC will be gen‐
525 erated for the extracted data or else unzip will fail during the
526 extraction because the ``decrypted'' bytes do not constitute a valid
527 compressed data stream.
528
529 If the first password fails the header check on some file, unzip will
530 prompt for another password, and so on until all files are extracted.
531 If a password is not known, entering a null password (that is, just a
532 carriage return or ``Enter'') is taken as a signal to skip all further
533 prompting. Only unencrypted files in the archive(s) will thereafter be
534 extracted. (In fact, that's not quite true; older versions of zip(1L)
535 and zipcloak(1L) allowed null passwords, so unzip checks each encrypted
536 file to see if the null password works. This may result in ``false
537 positives'' and extraction errors, as noted above.)
538
539 Archives encrypted with 8-bit passwords (for example, passwords with
540 accented European characters) may not be portable across systems and/or
541 other archivers. This problem stems from the use of multiple encoding
542 methods for such characters, including Latin-1 (ISO 8859-1) and OEM
543 code page 850. DOS PKZIP 2.04g uses the OEM code page; Windows PKZIP
544 2.50 uses Latin-1 (and is therefore incompatible with DOS PKZIP); Info-
545 ZIP uses the OEM code page on DOS, OS/2 and Win3.x ports but Latin-1
546 everywhere else; and Nico Mak's WinZip 6.x does not allow 8-bit pass‐
547 words at all. UnZip 5.3 (or newer) attempts to use the default charac‐
548 ter set first (e.g., Latin-1), followed by the alternate one (e.g., OEM
549 code page) to test passwords. On EBCDIC systems, if both of these
550 fail, EBCDIC encoding will be tested as a last resort. (EBCDIC is not
551 tested on non-EBCDIC systems, because there are no known archivers that
552 encrypt using EBCDIC encoding.) ISO character encodings other than
553 Latin-1 are not supported.
554
556 To use unzip to extract all members of the archive letters.zip into the
557 current directory and subdirectories below it, creating any subdirecto‐
558 ries as necessary:
559
560 unzip letters
561
562 To extract all members of letters.zip into the current directory only:
563
564 unzip -j letters
565
566 To test letters.zip, printing only a summary message indicating whether
567 the archive is OK or not:
568
569 unzip -tq letters
570
571 To test all zipfiles in the current directory, printing only the sum‐
572 maries:
573
574 unzip -tq \*.zip
575
576 (The backslash before the asterisk is only required if the shell
577 expands wildcards, as in Unix; double quotes could have been used
578 instead, as in the source examples below.) To extract to standard out‐
579 put all members of letters.zip whose names end in .tex, auto-converting
580 to the local end-of-line convention and piping the output into more(1):
581
582 unzip -ca letters \*.tex | more
583
584 To extract the binary file paper1.dvi to standard output and pipe it to
585 a printing program:
586
587 unzip -p articles paper1.dvi | dvips
588
589 To extract all FORTRAN and C source files--*.f, *.c, *.h, and Make‐
590 file--into the /tmp directory:
591
592 unzip source.zip "*.[fch]" Makefile -d /tmp
593
594 (the double quotes are necessary only in Unix and only if globbing is
595 turned on). To extract all FORTRAN and C source files, regardless of
596 case (e.g., both *.c and *.C, and any makefile, Makefile, MAKEFILE or
597 similar):
598
599 unzip -C source.zip "*.[fch]" makefile -d /tmp
600
601 To extract any such files but convert any uppercase MS-DOS or VMS names
602 to lowercase and convert the line-endings of all of the files to the
603 local standard (without respect to any files that might be marked
604 ``binary''):
605
606 unzip -aaCL source.zip "*.[fch]" makefile -d /tmp
607
608 To extract only newer versions of the files already in the current
609 directory, without querying (NOTE: be careful of unzipping in one
610 timezone a zipfile created in another--ZIP archives other than those
611 created by Zip 2.1 or later contain no timezone information, and a
612 ``newer'' file from an eastern timezone may, in fact, be older):
613
614 unzip -fo sources
615
616 To extract newer versions of the files already in the current directory
617 and to create any files not already there (same caveat as previous
618 example):
619
620 unzip -uo sources
621
622 To display a diagnostic screen showing which unzip and zipinfo options
623 are stored in environment variables, whether decryption support was
624 compiled in, the compiler with which unzip was compiled, etc.:
625
626 unzip -v
627
628 In the last five examples, assume that UNZIP or UNZIP_OPTS is set to
629 -q. To do a singly quiet listing:
630
631 unzip -l file.zip
632
633 To do a doubly quiet listing:
634
635 unzip -ql file.zip
636
637 (Note that the ``.zip'' is generally not necessary.) To do a standard
638 listing:
639
640 unzip --ql file.zip
641 or
642 unzip -l-q file.zip
643 or
644 unzip -l--q file.zip
645 (Extra minuses in options don't hurt.)
646
648 The current maintainer, being a lazy sort, finds it very useful to
649 define a pair of aliases: tt for ``unzip -tq'' and ii for ``unzip -Z''
650 (or ``zipinfo''). One may then simply type ``tt zipfile'' to test an
651 archive, something that is worth making a habit of doing. With luck
652 unzip will report ``No errors detected in compressed data of zip‐
653 file.zip,'' after which one may breathe a sigh of relief.
654
655 The maintainer also finds it useful to set the UNZIP environment vari‐
656 able to ``-aL'' and is tempted to add ``-C'' as well. His ZIPINFO
657 variable is set to ``-z''.
658
660 The exit status (or error level) approximates the exit codes defined by
661 PKWARE and takes on the following values, except under VMS:
662
663 0 normal; no errors or warnings detected.
664
665 1 one or more warning errors were encountered, but process‐
666 ing completed successfully anyway. This includes zip‐
667 files where one or more files was skipped due to unsup‐
668 ported compression method or encryption with an unknown
669 password.
670
671 2 a generic error in the zipfile format was detected. Pro‐
672 cessing may have completed successfully anyway; some bro‐
673 ken zipfiles created by other archivers have simple work-
674 arounds.
675
676 3 a severe error in the zipfile format was detected. Pro‐
677 cessing probably failed immediately.
678
679 4 unzip was unable to allocate memory for one or more buf‐
680 fers during program initialization.
681
682 5 unzip was unable to allocate memory or unable to obtain a
683 tty to read the decryption password(s).
684
685 6 unzip was unable to allocate memory during decompression
686 to disk.
687
688 7 unzip was unable to allocate memory during in-memory
689 decompression.
690
691 8 [currently not used]
692
693 9 the specified zipfiles were not found.
694
695 10 invalid options were specified on the command line.
696
697 11 no matching files were found.
698
699 50 the disk is (or was) full during extraction.
700
701 51 the end of the ZIP archive was encountered prematurely.
702
703 80 the user aborted unzip prematurely with control-C (or
704 similar)
705
706 81 testing or extraction of one or more files failed due to
707 unsupported compression methods or unsupported decryp‐
708 tion.
709
710 82 no files were found due to bad decryption password(s).
711 (If even one file is successfully processed, however, the
712 exit status is 1.)
713
714 VMS interprets standard Unix (or PC) return values as other, scarier-
715 looking things, so unzip instead maps them into VMS-style status codes.
716 The current mapping is as follows: 1 (success) for normal exit,
717 0x7fff0001 for warning errors, and (0x7fff000? + 16*nor‐
718 mal_unzip_exit_status) for all other errors, where the `?' is 2 (error)
719 for unzip values 2, 9-11 and 80-82, and 4 (fatal error) for the remain‐
720 ing ones (3-8, 50, 51). In addition, there is a compilation option to
721 expand upon this behavior: defining RETURN_CODES results in a human-
722 readable explanation of what the error status means.
723
725 Multi-part archives are not yet supported, except in conjunction with
726 zip. (All parts must be concatenated together in order, and then ``zip
727 -F'' must be performed on the concatenated archive in order to ``fix''
728 it.) This will definitely be corrected in the next major release.
729
730 Archives read from standard input are not yet supported, except with
731 funzip (and then only the first member of the archive can be
732 extracted).
733
734 Archives encrypted with 8-bit passwords (e.g., passwords with accented
735 European characters) may not be portable across systems and/or other
736 archivers. See the discussion in DECRYPTION above.
737
738 unzip's -M (``more'') option tries to take into account automatic wrap‐
739 ping of long lines. However, the code may fail to detect the correct
740 wrapping locations. First, TAB characters (and similar control
741 sequences) are not taken into account, they are handled as ordinary
742 printable characters. Second, depending on the actual system / OS
743 port, unzip may not detect the true screen geometry but rather rely on
744 "commonly used" default dimensions. The correct handling of tabs would
745 require the implementation of a query for the actual tabulator setup on
746 the output console.
747
748 Dates, times and permissions of stored directories are not restored
749 except under Unix. (On Windows NT and successors, timestamps are now
750 restored.)
751
752 [MS-DOS] When extracting or testing files from an archive on a defec‐
753 tive floppy diskette, if the ``Fail'' option is chosen from DOS's
754 ``Abort, Retry, Fail?'' message, older versions of unzip may hang the
755 system, requiring a reboot. This problem appears to be fixed, but con‐
756 trol-C (or control-Break) can still be used to terminate unzip.
757
758 Under DEC Ultrix, unzip would sometimes fail on long zipfiles (bad CRC,
759 not always reproducible). This was apparently due either to a hardware
760 bug (cache memory) or an operating system bug (improper handling of
761 page faults?). Since Ultrix has been abandoned in favor of Digital
762 Unix (OSF/1), this may not be an issue anymore.
763
764 [Unix] Unix special files such as FIFO buffers (named pipes), block
765 devices and character devices are not restored even if they are somehow
766 represented in the zipfile, nor are hard-linked files relinked. Basi‐
767 cally the only file types restored by unzip are regular files, directo‐
768 ries and symbolic (soft) links.
769
770 [OS/2] Extended attributes for existing directories are only updated if
771 the -o (``overwrite all'') option is given. This is a limitation of
772 the operating system; because directories only have a creation time
773 associated with them, unzip has no way to determine whether the stored
774 attributes are newer or older than those on disk. In practice this may
775 mean a two-pass approach is required: first unpack the archive nor‐
776 mally (with or without freshening/updating existing files), then over‐
777 write just the directory entries (e.g., ``unzip -o foo */'').
778
779 [VMS] When extracting to another directory, only the [.foo] syntax is
780 accepted for the -d option; the simple Unix foo syntax is silently
781 ignored (as is the less common VMS foo.dir syntax).
782
783 [VMS] When the file being extracted already exists, unzip's query only
784 allows skipping, overwriting or renaming; there should additionally be
785 a choice for creating a new version of the file. In fact, the ``over‐
786 write'' choice does create a new version; the old version is not over‐
787 written or deleted.
788
790 funzip(1L), zip(1L), zipcloak(1L), zipgrep(1L), zipinfo(1L), zip‐
791 note(1L), zipsplit(1L)
792
794 The Info-ZIP home page is currently at
795 http://www.info-zip.org/pub/infozip/
796 or
797 ftp://ftp.info-zip.org/pub/infozip/ .
798
800 The primary Info-ZIP authors (current semi-active members of the Zip-
801 Bugs workgroup) are: Ed Gordon (Zip, general maintenance, shared code,
802 Zip64, Win32, Unix); Christian Spieler (UnZip maintenance coordination,
803 VMS, MS-DOS, Win32, shared code, general Zip and UnZip integration and
804 optimization); Onno van der Linden (Zip); Mike White (Win32, Windows
805 GUI, Windows DLLs); Kai Uwe Rommel (OS/2, Win32); Steven M. Schweda
806 (VMS, support of new features); Paul Kienitz (Amiga, Win32); Chris Her‐
807 borth (BeOS, QNX, Atari); Jonathan Hudson (SMS/QDOS); Sergio Monesi
808 (Acorn RISC OS); Harald Denker (Atari, MVS); John Bush (Solaris,
809 Amiga); Hunter Goatley (VMS, Info-ZIP Site maintenance); Steve Salis‐
810 bury (Win32); Steve Miller (Windows CE GUI), Johnny Lee (MS-DOS, Win32,
811 Zip64); and Dave Smith (Tandem NSK).
812
813 The following people were former members of the Info-ZIP development
814 group and provided major contributions to key parts of the current
815 code: Greg ``Cave Newt'' Roelofs (UnZip, unshrink decompression); Jean-
816 loup Gailly (deflate compression); Mark Adler (inflate decompression,
817 fUnZip).
818
819 The author of the original unzip code upon which Info-ZIP's was based
820 is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
821 Kirschbaum organized and led Info-ZIP in its early days with Keith
822 Petersen hosting the original mailing list at WSMR-SimTel20. The full
823 list of contributors to UnZip has grown quite large; please refer to
824 the CONTRIBS file in the UnZip source distribution for a relatively
825 complete version.
826
828 v1.2 15 Mar 89 Samuel H. Smith
829 v2.0 9 Sep 89 Samuel H. Smith
830 v2.x fall 1989 many Usenet contributors
831 v3.0 1 May 90 Info-ZIP (DPK, consolidator)
832 v3.1 15 Aug 90 Info-ZIP (DPK, consolidator)
833 v4.0 1 Dec 90 Info-ZIP (GRR, maintainer)
834 v4.1 12 May 91 Info-ZIP
835 v4.2 20 Mar 92 Info-ZIP (Zip-Bugs subgroup, GRR)
836 v5.0 21 Aug 92 Info-ZIP (Zip-Bugs subgroup, GRR)
837 v5.01 15 Jan 93 Info-ZIP (Zip-Bugs subgroup, GRR)
838 v5.1 7 Feb 94 Info-ZIP (Zip-Bugs subgroup, GRR)
839 v5.11 2 Aug 94 Info-ZIP (Zip-Bugs subgroup, GRR)
840 v5.12 28 Aug 94 Info-ZIP (Zip-Bugs subgroup, GRR)
841 v5.2 30 Apr 96 Info-ZIP (Zip-Bugs subgroup, GRR)
842 v5.3 22 Apr 97 Info-ZIP (Zip-Bugs subgroup, GRR)
843 v5.31 31 May 97 Info-ZIP (Zip-Bugs subgroup, GRR)
844 v5.32 3 Nov 97 Info-ZIP (Zip-Bugs subgroup, GRR)
845 v5.4 28 Nov 98 Info-ZIP (Zip-Bugs subgroup, SPC)
846 v5.41 16 Apr 00 Info-ZIP (Zip-Bugs subgroup, SPC)
847 v5.42 14 Jan 01 Info-ZIP (Zip-Bugs subgroup, SPC)
848 v5.5 17 Feb 02 Info-ZIP (Zip-Bugs subgroup, SPC)
849 v5.51 22 May 04 Info-ZIP (Zip-Bugs subgroup, SPC)
850 v5.52 28 Feb 05 Info-ZIP (Zip-Bugs subgroup, SPC)
851
852
853
854Info-ZIP 28 February 2005 (v5.52) UNZIP(1L)