Penguin
Annotated edit history of unzip(1) version 2, including all changes. View license author blame.
Rev Author # Line
1 perry 1 UNZIP
2 !!!UNZIP
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 ARGUMENTS
7 OPTIONS
8 MODIFIERS
9 ENVIRONMENT OPTIONS
10 DECRYPTION
11 EXAMPLES
12 TIPS
13 DIAGNOSTICS
14 BUGS
15 SEE ALSO
16 URL
17 AUTHORS
18 VERSIONS
19 ----
20 !!NAME
21
22
23 unzip - list, test and extract compressed files in a ZIP archive
24 !!SYNOPSIS
25
26
27 __unzip__ [[__-Z__]
28 [[__-cflptuvz__[[__abjnoqsCLMVX$/:__]]
29 ''file''[[''.zip''] [[''file(s)'' ...] [[__-x__
30 ''xfile(s)'' ...] [[__-d__ ''exdir'']
31 !!DESCRIPTION
32
33
34 ''unzip'' will list, test, or extract files from a ZIP
35 archive, commonly found on MS-DOS systems. The default
36 behavior (with no options) is to extract into the current
37 directory (and subdirectories below it) all files from the
38 specified ZIP archive. A companion program, ''zip''(1L),
39 creates ZIP archives; both programs are compatible with
40 archives created by PKWARE's ''PKZIP'' and ''PKUNZIP''
41 for MS-DOS, but in many cases the program options or default
42 behaviors differ.
43 !!ARGUMENTS
44
45
46 ''file''[[''.zip'']
47
48
49 Path of the ZIP archive(s). If the file specification is a
50 wildcard, each matching file is processed in an order
51 determined by the operating system (or file system). Only
52 the filename can be a wildcard; the path itself cannot.
53 Wildcard expressions are similar to those supported in
54 commonly used Unix shells (''sh'', ''ksh'',
55 ''csh'') and may contain:
56
57
58 *
59
60
61 matches a sequence of 0 or more characters
62
63
64 ?
65
66
67 matches exactly 1 character
68
69
70 [[...]
71
72
73 matches any single character found inside the brackets;
74 ranges are specified by a beginning character, a hyphen, and
75 an ending character. If an exclamation point or a caret (`!'
76 or `^') follows the left bracket, then the range of
77 characters within the brackets is complemented (that is,
78 anything ''except'' the characters inside the brackets is
79 considered a match).
80
81
82 (Be sure to quote any character that might otherwise be
83 interpreted or modified by the operating system,
84 particularly under Unix and VMS.) If no matches are found,
85 the specification is assumed to be a literal filename; and
86 if that also fails, the suffix .zip is appended.
87 Note that self-extracting ZIP files are supported, as with
88 any other ZIP archive; just specify the .exe suffix
89 (if any) explicitly.
90
91
92 [[''file(s)'']
93
94
95 An optional list of archive members to be processed,
96 separated by spaces. (VMS versions compiled with VMSCLI
97 defined must delimit files with commas instead. See
98 __-v__ in __OPTIONS__ below.) Regular expressions
99 (wildcards) may be used to match multiple members; see
100 above. Again, be sure to quote expressions that would
101 otherwise be expanded or modified by the operating
102 system.
103
104
105 [[__-x__ ''xfile(s)'']
106
107
108 An optional list of archive members to be excluded from
109 processing. Since wildcard characters match directory
110 separators (`/'), this option may be used to exclude any
111 files that are in subdirectories. For example, ``unzip
112 foo *.[[ch] -x */*'' would extract all C source files in
113 the main directory, but none in any subdirectories. Without
114 the __-x__ option, all C source files in all directories
115 within the zipfile would be extracted.
116
117
118 [[__-d__ ''exdir'']
119
120
121 An optional directory to which to extract files. By default,
122 all files and subdirectories are recreated in the current
123 directory; the __-d__ option allows extraction in an
124 arbitrary directory (always assuming one has permission to
125 write to the directory). This option need not appear at the
126 end of the command line; it is also accepted before the
127 zipfile specification (with the normal options), immediately
128 after the zipfile specification, or between the
129 ''file(s)'' and the __-x__ option. The option and
130 directory may be concatenated without any white space
131 between them, but note that this may cause normal shell
132 behavior to be suppressed. In particular, ``-d ~''
133 (tilde) is expanded by Unix C shells into the name of the
134 user's home directory, but ``-d~'' is treated as a
135 literal subdirectory ``__~__'' of the current
136 directory.
137 !!OPTIONS
138
139
140 Note that, in order to support obsolescent hardware,
141 ''unzip'''s usage screen is limited to 22 or 23 lines and
142 should therefore be considered only a reminder of the basic
143 ''unzip'' syntax rather than an exhaustive list of all
144 possible flags. The exhaustive list follows:
145
146
147 __-Z__
148
149
150 ''zipinfo''(1L) mode. If the first option on the command
151 line is __-Z__, the remaining options are taken to be
152 ''zipinfo''(1L) options. See the appropriate manual page
153 for a description of these options.
154
155
156 __-A__
157
158
159 [[OS/2, Unix DLL] print extended help for the DLL's
160 programming interface (API).
161
162
163 __-c__
164
165
166 extract files to stdout/screen (``CRT''). This option is
167 similar to the __-p__ option except that the name of each
168 file is printed as it is extracted, the __-a__ option is
169 allowed, and ASCII-EBCDIC conversion is automatically
170 performed if appropriate. This option is not listed in the
171 ''unzip'' usage screen.
172
173
174 __-f__
175
176
177 freshen existing files, i.e., extract only those files that
178 already exist on disk and that are newer than the disk
179 copies. By default ''unzip'' queries before overwriting,
180 but the __-o__ option may be used to suppress the
181 queries. Note that under many operating systems, the TZ
182 (timezone) environment variable must be set correctly in
183 order for __-f__ and __-u__ to work properly (under
184 Unix the variable is usually set automatically). The reasons
185 for this are somewhat subtle but have to do with the
186 differences between DOS-format file times (always local
187 time) and Unix-format times (always in GMT/UTC) and the
188 necessity to compare the two. A typical TZ value is
189 ``PST8PDT'' (US Pacific time with automatic adjustment for
190 Daylight Savings Time or ``summer time'').
191
192
193 __-l__
194
195
196 list archive files (short format). The names, uncompressed
197 file sizes and modification dates and times of the specified
198 files are printed, along with totals for all files
2 perry 199 specified. If !UnZip was compiled with OS2_EAS defined, the
1 perry 200 __-l__ option also lists columns for the sizes of stored
201 OS/2 extended attributes (EAs) and OS/2 access control lists
202 (ACLs). In addition, the zipfile comment and individual file
203 comments (if any) are displayed. If a file was archived from
204 a single-case file system (for example, the old MS-DOS FAT
205 file system) and the __-L__ option was given, the
206 filename is converted to lowercase and is prefixed with a
207 caret (^).
208
209
210 __-p__
211
212
213 extract files to pipe (stdout). Nothing but the file data is
214 sent to stdout, and the files are always extracted in binary
215 format, just as they are stored (no
216 conversions).
217
218
219 __-t__
220
221
222 test archive files. This option extracts each specified file
223 in memory and compares the CRC (cyclic redundancy check, an
224 enhanced checksum) of the expanded file with the original
225 file's stored CRC value.
226
227
228 __-T__
229
230
231 [[most OSes] set the timestamp on the archive(s) to that of
232 the newest file in each one. This corresponds to
233 ''zip'''s __-go__ option except that it can be used on
234 wildcard zipfiles (e.g., ``unzip -T *.zip'') and is
235 much faster.
236
237
238 __-u__
239
240
241 update existing files and create new ones if needed. This
242 option performs the same function as the __-f__ option,
243 extracting (with query) files that are newer than those with
244 the same name on disk, and in addition it extracts those
245 files that do not already exist on disk. See __-f__ above
246 for information on setting the timezone
247 properly.
248
249
250 __-v__
251
252
253 be verbose or print diagnostic version info. This option has
254 evolved and now behaves as both an option and a modifier. As
255 an option it has two purposes: when a zipfile is specified
256 with no other options, __-v__ lists archive files
257 verbosely, adding to the basic __-l__ info the
258 compression method, compressed size, compression ratio and
259 32-bit CRC. When no zipfile is specified (that is, the
260 complete command is simply ``unzip -v''), a
261 diagnostic screen is printed. In addition to the normal
262 header with release date and version, ''unzip'' lists the
263 home Info-ZIP ftp site and where to find a list of other ftp
264 and non-ftp sites; the target operating system for which it
265 was compiled, as well as (possibly) the hardware on which it
266 was compiled, the compiler and version used, and the
267 compilation date; any special compilation options that might
268 affect the program's operation (see also __DECRYPTION__
269 below); and any options stored in environment variables that
270 might do the same (see __ENVIRONMENT OPTIONS__ below). As
271 a modifier it works in conjunction with other options (e.g.,
272 __-t__) to produce more verbose or debugging output; this
273 is not yet fully implemented but will be in future
274 releases.
275
276
277 __-z__
278
279
280 display only the archive comment.
281 !!MODIFIERS
282
283
284 __-a__
285
286
287 convert text files. Ordinarily all files are extracted
288 exactly as they are stored (as ``binary'' files). The
289 __-a__ option causes files identified by ''zip'' as
290 text files (those with the `t' label in ''zipinfo''
291 listings, rather than `b') to be automatically extracted as
292 such, converting line endings, end-of-file characters and
293 the character set itself as necessary. (For example, Unix
294 files use line feeds (LFs) for end-of-line (EOL) and have no
295 end-of-file (EOF) marker; Macintoshes use carriage returns
296 (CRs) for EOLs; and most PC operating systems use CR+LF for
297 EOLs and control-Z for EOF. In addition, IBM mainframes and
298 the Michigan Terminal System use EBCDIC rather than the more
299 common ASCII character set, and NT supports Unicode.) Note
300 that ''zip'''s identification of text files is by no
301 means perfect; some ``text'' files may actually be binary
302 and vice versa. ''unzip'' therefore prints
303 ``[[text]'' or ``[[binary]'' as a visual
304 check for each file it extracts when using the __-a__
305 option. The __-aa__ option forces all files to be
306 extracted as text, regardless of the supposed file
307 type.
308
309
310 __-b__
311
312
313 [[general] treat all files as binary (no text conversions).
314 This is a shortcut for __---a__.
315
316
317 __-b__
318
319
320 [[Tandem] force the creation files with filecode type 180
321 ('C') when extracting Zip entries marked as
322 -a__ is enabled by
323 default, see above).
324
325
326 __-b__
327
328
329 [[VMS] auto-convert binary files (see __-a__ above) to
330 fixed-length, 512-byte record format. Doubling the option
331 (__-bb__) forces all files to be extracted in this
332 format. When extracting to standard output (__-c__ or
333 __-p__ option in effect), the default conversion of text
334 record delimiters is disabled for binary (__-b__) resp.
335 all (__-bb__) files.
336
337
338 __-B__
339
340
341 [[Unix only, and only if compiled with UNIXBACKUP defined]
342 save a backup copy of each overwritten file with a tilde
343 appended (e.g., the old copy of ``foo'' is renamed
344 to ``foo~''). This is similar to the default
345 behavior of emacs(1) in many locations.
346
347
348 __-C__
349
350
351 match filenames case-insensitively. ''unzip'''s
352 philosophy is ``you get what you ask for'' (this is also
353 responsible for the __-L__/__-U__ change; see the
354 relevant options below). Because some file systems are fully
355 case-sensitive (notably those under the Unix operating
356 system) and because both ZIP archives and ''unzip''
357 itself are portable across platforms, ''unzip'''s default
358 behavior is to match both wildcard and literal filenames
359 case-sensitively. That is, specifying ``makefile''
360 on the command line will ''only'' match ``makefile'' in
361 the archive, not ``Makefile'' or ``MAKEFILE'' (and similarly
362 for wildcard specifications). Since this does not correspond
363 to the behavior of many other operating/file systems (for
364 example, OS/2 HPFS, which preserves mixed case but is not
365 sensitive to it), the __-C__ option may be used to force
366 all filename matches to be case-insensitive. In the example
367 above, all three files would then match
368 ``makefile'' (or ``make*'', or similar).
369 The __-C__ option affects files in both the normal file
370 list and the excluded-file list (xlist).
371
372
373 __-E__
374
375
376 [[MacOS only] display contents of MacOS extra field during
377 restore operation.
378
379
380 __-F__
381
382
383 [[Acorn only] suppress removal of NFS filetype extension from
384 stored filenames.
385
386
387 __-F__
388
389
390 [[non-Acorn systems supporting long filenames with embedded
391 commas, and only if compiled with ACORN_FTYPE_NFS defined]
392 translate filetype information from ACORN RISC OS extra
393 field blocks into a NFS filetype extension and append it to
394 the names of the extracted files. (When the stored filename
395 appears to already have an appended NFS filetype extension,
396 it is replaced by the info from the extra
397 field.)
398
399
400 __-i__
401
402
403 [[MacOS only] ignore filenames stored in MacOS extra fields.
404 Instead, the most compatible filename stored in the generic
405 part of the entry's header is used.
406
407
408 __-j__
409
410
411 junk paths. The archive's directory structure is not
412 recreated; all files are deposited in the extraction
413 directory (by default, the current one).
414
415
416 __-J__
417
418
419 [[BeOS only] junk file attributes. The file's BeOS file
420 attributes are not restored, just the file's
421 data.
422
423
424 __-J__
425
426
427 [[MacOS only] ignore MacOS extra fields. All Macintosh
428 specific info is skipped. Data-fork and resource-fork are
429 restored as separate files.
430
431
432 __-L__
433
434
435 convert to lowercase any filename originating on an
436 uppercase-only operating system or file system. (This was
437 ''unzip'''s default behavior in releases prior to 5.11;
438 the new default behavior is identical to the old behavior
439 with the __-U__ option, which is now obsolete and will be
440 removed in a future release.) Depending on the archiver,
441 files archived under single-case file systems (VMS, old
442 MS-DOS FAT, etc.) may be stored as all-uppercase names; this
443 can be ugly or inconvenient when extracting to a
444 case-preserving file system such as OS/2 HPFS or a
445 case-sensitive one such as under Unix. By default
446 ''unzip'' lists and extracts such filenames exactly as
447 they're stored (excepting truncation, conversion of
448 unsupported characters, etc.); this option causes the names
449 of all files from certain systems to be converted to
450 lowercase. The __-LL__ option forces conversion of every
451 filename to lowercase, regardless of the originating file
452 system.
453
454
455 __-M__
456
457
458 pipe all output through an internal pager similar to the
459 Unix more(1) command. At the end of a screenful of
460 output, ''unzip'' pauses with a ``--More--'' prompt; the
461 next screenful may be viewed by pressing the Enter (Return)
462 key or the space bar. ''unzip'' can be terminated by
463 pressing the ``q'' key and, on some systems, the
464 Enter/Return key. Unlike Unix more(1), there is no
465 forward-searching or editing capability. Also, ''unzip''
466 doesn't notice if long lines wrap at the edge of the screen,
467 effectively resulting in the printing of two or more lines
468 and the likelihood that some text will scroll off the top of
469 the screen before being viewed. On some systems the number
470 of available lines on the screen is not detected, in which
471 case ''unzip'' assumes the height is 24
472 lines.
473
474
475 __-n__
476
477
478 never overwrite existing files. If a file already exists,
479 skip the extraction of that file without prompting. By
480 default ''unzip'' queries before extracting any file that
481 already exists; the user may choose to overwrite only the
482 current file, overwrite all files, skip extraction of the
483 current file, skip extraction of all existing files, or
484 rename the current file.
485
486
487 __-N__
488
489
490 [[Amiga] extract file comments as Amiga filenotes. File
491 comments are created with the -c option of ''zip''(1L),
492 or with the -N option of the Amiga port of ''zip''(1L),
493 which stores filenotes as comments.
494
495
496 __-o__
497
498
499 overwrite existing files without prompting. This is a
500 dangerous option, so use it with care. (It is often used
501 with __-f__, however, and is the only way to overwrite
502 directory EAs under OS/2.)
503
504
505 __-P__ ''password''
506
507
508 use ''password'' to decrypt encrypted zipfile entries (if
509 any). __THIS IS INSECURE!__ Many multi-user operating
510 systems provide ways for any user to see the current command
511 line of any other user; even on stand-alone systems there is
512 always the threat of over-the-shoulder peeking. Storing the
513 plaintext password as part of a command line in an automated
514 script is even worse. Whenever possible, use the
515 non-echoing, interactive prompt to enter passwords. (And
516 where security is truly important, use strong encryption
517 such as Pretty Good Privacy instead of the relatively weak
518 encryption provided by standard zipfile
519 utilities.)
520
521
522 __-q__
523
524
525 perform operations quietly (__-qq__ = even quieter).
526 Ordinarily ''unzip'' prints the names of the files it's
527 extracting or testing, the extraction methods, any file or
528 zipfile comments that may be stored in the archive, and
529 possibly a summary when finished with each archive. The
530 __-q__[[__q__] options suppress the printing of some or
531 all of these messages.
532
533
534 __-s__
535
536
537 [[OS/2, NT, MS-DOS] convert spaces in filenames to
538 underscores. Since all PC operating systems allow spaces in
539 filenames, ''unzip'' by default extracts filenames with
540 spaces intact (e.g., ``EA DATA. SF''). This can be
541 awkward, however, since MS-DOS in particular does not
542 gracefully support spaces in filenames. Conversion of spaces
543 to underscores can eliminate the awkwardness in some
544 cases.
545
546
547 __-U__
548
549
550 (obsolete; to be removed in a future release) leave
551 filenames uppercase if created under MS-DOS, VMS, etc. See
552 __-L__ above.
553
554
555 __-V__
556
557
558 retain (VMS) file version numbers. VMS files can be stored
559 with a version number, in the format file.ext;##.
560 By default the ``;##'' version numbers are
561 stripped, but this option allows them to be retained. (On
562 file systems that limit filenames to particularly short
563 lengths, the version numbers may be truncated or stripped
564 regardless of this option.)
565
566
567 __-X__
568
569
570 [[VMS, Unix, OS/2, NT] restore owner/protection info (UICs)
571 under VMS, or user and group info (UID/GID) under Unix, or
572 access control lists (ACLs) under certain network-enabled
573 versions of OS/2 (Warp Server with IBM LAN Server/Requester
574 3.0 to 5.0; Warp Connect with IBM Peer 1.0), or security
575 ACLs under Windows NT. In most cases this will require
576 special system privileges, and doubling the option
577 (__-XX__) under NT instructs ''unzip'' to use
578 privileges for extraction; but under Unix, for example, a
579 user who belongs to several groups can restore files owned
580 by any of those groups, as long as the user IDs match his or
581 her own. Note that ordinary file attributes are always
582 restored--this option applies only to optional, extra
583 ownership info available on some operating systems. [[NT's
584 access control lists do not appear to be especially
585 compatible with OS/2's, so no attempt is made at
586 cross-platform portability of access privileges. It is not
587 clear under what conditions this would ever be useful
588 anyway.]
589
590
591 __-$__
592
593
594 [[MS-DOS, OS/2, NT] restore the volume label if the
595 extraction medium is removable (e.g., a diskette). Doubling
596 the option (__-$$__) allows fixed media (hard disks) to
597 be labelled as well. By default, volume labels are
598 ignored.
599
600
601 __-/__ ''extensions''
602
603
604 [[Acorn only] overrides the extension list supplied by
605 Unzip$Ext environment variable. During extraction, filename
606 extensions that match one of the items in this extension
607 list are swapped in front of the base name of the extracted
608 file.
609
610
611 __-:__
612
613
614 [[all but Acorn, VM/CMS, MVS, Tandem] allows to extract
615 archive members into locations outside of the current ``
616 extraction root folder''. For security reasons, ''unzip''
617 normally removes ``parent dir'' path components (``../'')
618 from the names of extracted file. This safety feature (new
619 for version 5.50) prevents ''unzip'' from accidentally
620 writing files to ``sensitive'' areas outside the active
621 extraction folder tree head. The __-:__ option lets
622 ''unzip'' switch back to its previous, more liberal
623 behaviour, to allow exact extraction of (older) archives
624 that used ``../'' components to create multiple directory
625 trees at the level of the current extraction
626 folder.
627 !!ENVIRONMENT OPTIONS
628
629
630 ''unzip'''s default behavior may be modified via options
631 placed in an environment variable. This can be done with any
632 option, but it is probably most useful with the __-a__,
633 __-L__, __-C__, __-q__, __-o__, or __-n__
634 modifiers: make ''unzip'' auto-convert text files by
635 default, make it convert filenames from uppercase systems to
636 lowercase, make it match names case-insensitively, make it
637 quieter, or make it always overwrite or never overwrite
638 files as it extracts them. For example, to make ''unzip''
639 act as quietly as possible, only reporting errors, one would
640 use one of the following commands:
641
642
643 Unix Bourne shell:
644
645
646 UNZIP=-qq; export UNZIP
647
648
649 Unix C shell:
650
651
652 setenv UNZIP -qq
653
654
655 OS/2 or MS-DOS:
656
657
658 set UNZIP=-qq
659
660
661 VMS (quotes for ''lowercase''):
662
663
664 define UNZIP_OPTS
665
666
667 Environment options are, in effect, considered to be just
668 like any other command-line options, except that they are
669 effectively the first options on the command line. To
670 override an environment option, one may use the ``minus
671 operator'' to remove it. For instance, to override one of
672 the quiet-flags in the example above, use the
673 command
674
675
676 unzip --q[[''other options''
677
678
679 ] zipfile
680
681
682 The first hyphen is the normal switch character, and the
683 second is a minus sign, acting on the q option. Thus the
684 effect here is to cancel one quantum of quietness. To cancel
685 both quiet flags, two (or more) minuses may be
686 used:
687
688
689 unzip -t--q zipfile
690 unzip ---qt zipfile
691
692
693 (the two are equivalent). This may seem awkward or
694 confusing, but it is reasonably intuitive: just ignore the
695 first hyphen and go from there. It is also consistent with
696 the behavior of Unix nice(1).
697
698
699 As suggested by the examples above, the default variable
700 names are UNZIP_OPTS for VMS (where the symbol used to
701 install ''unzip'' as a foreign command would otherwise be
702 confused with the environment variable), and UNZIP for all
703 other operating systems. For compatibility with
704 ''zip''(1L), UNZIPOPT is also accepted (don't ask). If
705 both UNZIP and UNZIPOPT are defined, however, UNZIP takes
706 precedence. ''unzip'''s diagnostic option (__-v__ with
707 no zipfile name) can be used to check the values of all four
708 possible ''unzip'' and ''zipinfo'' environment
709 variables.
710
711
712 The timezone variable (TZ) should be set according to the
713 local timezone in order for the __-f__ and __-u__ to
714 operate correctly. See the description of __-f__ above
715 for details. This variable may also be necessary in order
716 for timestamps on extracted files to be set correctly. Under
717 Windows 95/NT ''unzip'' should know the correct timezone
718 even if TZ is unset, assuming the timezone is correctly set
719 in the Control Panel.
720 !!DECRYPTION
721
722
723 Encrypted archives are fully supported by Info-ZIP software,
724 but due to United States export restrictions, de-/encryption
725 support might be disabled in your compiled binary. However,
726 since spring 2000, US export restrictions have been
727 liberated, and our source archives do now include full crypt
728 code. In case you need binary distributions with crypt
729 support enabled, see the file ``WHERE'' in any Info-ZIP
730 source or binary distribution for locations both inside and
731 outside the US.
732
733
734 Some compiled versions of ''unzip'' may not support
735 decryption. To check a version for crypt support, either
736 attempt to test or extract an encrypted archive, or else
737 check ''unzip'''s diagnostic screen (see the __-v__
738 option above) for ``[[decryption]'' as one of the
739 special compilation options.
740
741
742 As noted above, the __-P__ option may be used to supply a
743 password on the command line, but at a cost in security. The
744 preferred decryption method is simply to extract normally;
745 if a zipfile member is encrypted, ''unzip'' will prompt
746 for the password without echoing what is typed. ''unzip''
747 continues to use the same password as long as it appears to
748 be valid, by testing a 12-byte header on each file. The
749 correct password will always check out against the header,
750 but there is a 1-in-256 chance that an incorrect password
751 will as well. (This is a security feature of the PKWARE
752 zipfile format; it helps prevent brute-force attacks that
753 might otherwise gain a large speed advantage by testing only
754 the header.) In the case that an incorrect password is given
755 but it passes the header test anyway, either an incorrect
756 CRC will be generated for the extracted data or else
757 ''unzip'' will fail during the extraction because the
758 ``decrypted'' bytes do not constitute a valid compressed
759 data stream.
760
761
762 If the first password fails the header check on some file,
763 ''unzip'' will prompt for another password, and so on
764 until all files are extracted. If a password is not known,
765 entering a null password (that is, just a carriage return or
766 ``Enter'') is taken as a signal to skip all further
767 prompting. Only unencrypted files in the archive(s) will
768 thereafter be extracted. (In fact, that's not quite true;
769 older versions of ''zip''(1L) and ''zipcloak''(1L)
770 allowed null passwords, so ''unzip'' checks each
771 encrypted file to see if the null password works. This may
772 result in ``false positives'' and extraction errors, as
773 noted above.)
774
775
776 Archives encrypted with 8-bit passwords (for example,
777 passwords with accented European characters) may not be
778 portable across systems and/or other archivers. This problem
779 stems from the use of multiple encoding methods for such
780 characters, including Latin-1 (ISO 8859-1) and OEM code page
781 850. DOS ''PKZIP'' 2.04g uses the OEM code page; Windows
782 ''PKZIP'' 2.50 uses Latin-1 (and is therefore
783 incompatible with DOS ''PKZIP''); Info-ZIP uses the OEM
784 code page on DOS, OS/2 and Win3.x ports but Latin-1
2 perry 785 everywhere else; and Nico Mak's ''!WinZip'' 6.x does not
786 allow 8-bit passwords at all. ''!UnZip'' 5.3 (or newer)
1 perry 787 attempts to use the default character set first (e.g.,
788 Latin-1), followed by the alternate one (e.g., OEM code
789 page) to test passwords. On EBCDIC systems, if both of these
790 fail, EBCDIC encoding will be tested as a last resort.
791 (EBCDIC is not tested on non-EBCDIC systems, because there
792 are no known archivers that encrypt using EBCDIC encoding.)
793 ISO character encodings other than Latin-1 are not
794 supported.
795 !!EXAMPLES
796
797
798 To use ''unzip'' to extract all members of the archive
799 ''letters.zip'' into the current directory and
800 subdirectories below it, creating any subdirectories as
801 necessary:
802
803
804 unzip letters
805
806
807 To extract all members of ''letters.zip'' into the
808 current directory only:
809
810
811 unzip -j letters
812
813
814 To test ''letters.zip'', printing only a summary message
815 indicating whether the archive is OK or not:
816
817
818 unzip -tq letters
819
820
821 To test ''all'' zipfiles in the current directory,
822 printing only the summaries:
823
824
825 unzip -tq *.zip
826
827
828 (The backslash before the asterisk is only required if the
829 shell expands wildcards, as in Unix; double quotes could
830 have been used instead, as in the source examples below.) To
831 extract to standard output all members of ''letters.zip''
832 whose names end in ''.tex'', auto-converting to the local
833 end-of-line convention and piping the output into
834 more(1):
835
836
837 unzip -ca letters *.tex | more
838
839
840 To extract the binary file ''paper1.dvi'' to standard
841 output and pipe it to a printing program:
842
843
844 unzip -p articles paper1.dvi | dvips
845
846
847 To extract all FORTRAN and C source files--*.f, *.c, *.h,
848 and Makefile--into the /tmp directory:
849
850
851 unzip source.zip
852
853
854 (the double quotes are necessary only in Unix and only if
855 globbing is turned on). To extract all FORTRAN and C source
856 files, regardless of case (e.g., both *.c and *.C, and any
857 makefile, Makefile, MAKEFILE or similar):
858
859
860 unzip -C source.zip
861
862
863 To extract any such files but convert any uppercase MS-DOS
864 or VMS names to lowercase and convert the line-endings of
865 all of the files to the local standard (without respect to
866 any files that might be marked ``binary''):
867
868
869 unzip -aaCL source.zip
870
871
872 To extract only newer versions of the files already in the
873 current directory, without querying (NOTE: be careful of
874 unzipping in one timezone a zipfile created in another--ZIP
875 archives other than those created by Zip 2.1 or later
876 contain no timezone information, and a ``newer'' file from
877 an eastern timezone may, in fact, be older):
878
879
880 unzip -fo sources
881
882
883 To extract newer versions of the files already in the
884 current directory and to create any files not already there
885 (same caveat as previous example):
886
887
888 unzip -uo sources
889
890
891 To display a diagnostic screen showing which ''unzip''
892 and ''zipinfo'' options are stored in environment
893 variables, whether decryption support was compiled in, the
894 compiler with which ''unzip'' was compiled,
895 etc.:
896
897
898 unzip -v
899
900
901 In the last five examples, assume that UNZIP or UNZIP_OPTS
902 is set to -q. To do a singly quiet listing:
903
904
905 unzip -l file.zip
906
907
908 To do a doubly quiet listing:
909
910
911 unzip -ql file.zip
912
913
914 (Note that the ``.zip'' is generally not
915 necessary.) To do a standard listing:
916
917
918 unzip --ql file.zip
919
920
921 or
922
923
924 unzip -l-q file.zip
925
926
927 or
928
929
930 unzip -l--q file.zip
931
932
933 (Extra minuses in options don't hurt.)
934 !!TIPS
935
936
937 The current maintainer, being a lazy sort, finds it very
938 useful to define a pair of aliases: tt for
939 ``unzip -tq'' and ii for ``unzip
940 -Z'' (or ``zipinfo''). One may then simply
941 type ``tt zipfile'' to test an archive, something
942 that is worth making a habit of doing. With luck
943 ''unzip'' will report ``No errors detected in
944 compressed data of zipfile.zip,'' after which one may
945 breathe a sigh of relief.
946
947
948 The maintainer also finds it useful to set the UNZIP
949 environment variable to ``-aL'' and is tempted to
950 add ``-C'' as well. His ZIPINFO variable is set to
951 ``-z''.
952 !!DIAGNOSTICS
953
954
955 The exit status (or error level) approximates the exit codes
956 defined by PKWARE and takes on the following values, except
957 under VMS:
958
959
960 0
961
962
963 normal; no errors or warnings detected.
964
965
966 1
967
968
969 one or more warning errors were encountered, but processing
970 completed successfully anyway. This includes zipfiles where
971 one or more files was skipped due to unsupported compression
972 method or encryption with an unknown password.
973
974
975 2
976
977
978 a generic error in the zipfile format was detected.
979 Processing may have completed successfully anyway; some
980 broken zipfiles created by other archivers have simple
981 work-arounds.
982
983
984 3
985
986
987 a severe error in the zipfile format was detected.
988 Processing probably failed immediately.
989
990
991 4
992
993
994 ''unzip'' was unable to allocate memory for one or more
995 buffers during program initialization.
996
997
998 5
999
1000
1001 ''unzip'' was unable to allocate memory or unable to
1002 obtain a tty to read the decryption
1003 password(s).
1004
1005
1006 6
1007
1008
1009 ''unzip'' was unable to allocate memory during
1010 decompression to disk.
1011
1012
1013 7
1014
1015
1016 ''unzip'' was unable to allocate memory during in-memory
1017 decompression.
1018
1019
1020 8
1021
1022
1023 [[currently not used]
1024
1025
1026 9
1027
1028
1029 the specified zipfiles were not found.
1030
1031
1032 10
1033
1034
1035 invalid options were specified on the command
1036 line.
1037
1038
1039 11
1040
1041
1042 no matching files were found.
1043
1044
1045 50
1046
1047
1048 the disk is (or was) full during extraction.
1049
1050
1051 51
1052
1053
1054 the end of the ZIP archive was encountered
1055 prematurely.
1056
1057
1058 80
1059
1060
1061 the user aborted ''unzip'' prematurely with control-C (or
1062 similar)
1063
1064
1065 81
1066
1067
1068 testing or extraction of one or more files failed due to
1069 unsupported compression methods or unsupported
1070 decryption.
1071
1072
1073 82
1074
1075
1076 no files were found due to bad decryption password(s). (If
1077 even one file is successfully processed, however, the exit
1078 status is 1.)
1079
1080
1081 VMS interprets standard Unix (or PC) return values as other,
1082 scarier-looking things, so ''unzip'' instead maps them
1083 into VMS-style status codes. The current mapping is as
1084 follows: 1 (success) for normal exit, 0x7fff0001 for warning
1085 errors, and (0x7fff000? + 16*normal_unzip_exit_status) for
1086 all other errors, where the `?' is 2 (error) for
1087 ''unzip'' values 2, 9-11 and 80-82, and 4 (fatal error)
1088 for the remaining ones (3-8, 50, 51). In addition, there is
1089 a compilation option to expand upon this behavior: defining
1090 RETURN_CODES results in a human-readable explanation of what
1091 the error status means.
1092 !!BUGS
1093
1094
1095 Multi-part archives are not yet supported, except in
1096 conjunction with ''zip''. (All parts must be concatenated
1097 together in order, and then ``zip -F'' must be
1098 performed on the concatenated archive in order to ``fix''
1099 it.) This will definitely be corrected in the next major
1100 release.
1101
1102
1103 Archives read from standard input are not yet supported,
1104 except with ''funzip'' (and then only the first member of
1105 the archive can be extracted).
1106
1107
1108 Archives encrypted with 8-bit passwords (e.g., passwords
1109 with accented European characters) may not be portable
1110 across systems and/or other archivers. See the discussion in
1111 __DECRYPTION__ above.
1112
1113
1114 ''unzip'''s __-M__ (``more'') option is overly
1115 simplistic in its handling of screen output; as noted above,
1116 it fails to detect the wrapping of long lines and may
1117 thereby cause lines at the top of the screen to be scrolled
1118 off before being read. ''unzip'' should detect and treat
1119 each occurrence of line-wrap as one additional line printed.
1120 This requires knowledge of the screen's width as well as its
1121 height. In addition, ''unzip'' should detect the true
1122 screen geometry on all systems.
1123
1124
1125 Dates, times and permissions of stored directories are not
1126 restored except under Unix.
1127
1128
1129 [[MS-DOS] When extracting or testing files from an archive on
1130 a defective floppy diskette, if the ``Fail'' option is
1131 chosen from DOS's ``Abort, Retry, Fail?'' message, older
1132 versions of ''unzip'' may hang the system, requiring a
1133 reboot. This problem appears to be fixed, but control-C (or
1134 control-Break) can still be used to terminate
1135 ''unzip''.
1136
1137
1138 Under DEC Ultrix, ''unzip'' would sometimes fail on long
1139 zipfiles (bad CRC, not always reproducible). This was
1140 apparently due either to a hardware bug (cache memory) or an
1141 operating system bug (improper handling of page faults?).
1142 Since Ultrix has been abandoned in favor of Digital Unix
1143 (OSF/1), this may not be an issue anymore.
1144
1145
1146 [[Unix] Unix special files such as FIFO buffers (named
1147 pipes), block devices and character devices are not restored
1148 even if they are somehow represented in the zipfile, nor are
1149 hard-linked files relinked. Basically the only file types
1150 restored by ''unzip'' are regular files, directories and
1151 symbolic (soft) links.
1152
1153
1154 [[OS/2] Extended attributes for existing directories are only
1155 updated if the __-o__ (``overwrite all'') option is
1156 given. This is a limitation of the operating system; because
1157 directories only have a creation time associated with them,
1158 ''unzip'' has no way to determine whether the stored
1159 attributes are newer or older than those on disk. In
1160 practice this may mean a two-pass approach is required:
1161 first unpack the archive normally (with or without
1162 freshening/updating existing files), then overwrite just the
1163 directory entries (e.g., ``unzip -o foo
1164 */'').
1165
1166
1167 [[VMS] When extracting to another directory, only the
1168 ''[[.foo]'' syntax is accepted for the __-d__ option;
1169 the simple Unix ''foo'' syntax is silently ignored (as is
1170 the less common VMS ''foo.dir'' syntax).
1171
1172
1173 [[VMS] When the file being extracted already exists,
1174 ''unzip'''s query only allows skipping, overwriting or
1175 renaming; there should additionally be a choice for creating
1176 a new version of the file. In fact, the ``overwrite'' choice
1177 does create a new version; the old version is not
1178 overwritten or deleted.
1179 !!SEE ALSO
1180
1181
1182 ''funzip''(1L), ''zip''(1L), ''zipcloak''(1L),
1183 ''zipgrep''(1L), ''zipinfo''(1L), ''zipnote''(1L),
1184 ''zipsplit''(1L)
1185 !!URL
1186
1187
1188 The Info-ZIP home page is currently at
1189
1190
1191 http://www.info-zip.org/pub/infozip/
1192
1193
1194 or
1195
1196
1197 ftp://ftp.info-zip.org/pub/infozip/ .
1198 !!AUTHORS
1199
1200
1201 The primary Info-ZIP authors (current semi-active members of
1202 the Zip-Bugs workgroup) are: Greg ``Cave Newt'' Roelofs
2 perry 1203 (!UnZip); Onno van der Linden (Zip); Jean-loup Gailly
1 perry 1204 (compression); Mark Adler (decompression, fUnZip); Christian
2 perry 1205 Spieler (!UnZip maintance coordination, VMS, MS-DOS, Windows
1206 95, NT, shared code, general Zip and !UnZip integration and
1 perry 1207 optimization); Mike White (Windows GUI, Windows DLLs); Kai
1208 Uwe Rommel (OS/2); Paul Kienitz (Amiga, Windows 95); Chris
1209 Herborth (BeOS, QNX, Atari); Jonathan Hudson (SMS/QDOS);
1210 Sergio Monesi (Acorn RISC OS); Harald Denker (Atari, MVS);
1211 John Bush (Solaris, Amiga); Hunter Goatley (VMS); Steve
1212 Salisbury (Windows 95, NT); Steve Miller (Windows CE GUI),
1213 Johnny Lee (MS-DOS, Windows 95, NT); and Dave Smith (Tandem
1214 NSK). The author of the original unzip code upon which
1215 Info-ZIP's was based is Samuel H. Smith; Carl Mascott did
1216 the first Unix port; and David P. Kirschbaum organized and
1217 led Info-ZIP in its early days with Keith Petersen hosting
1218 the original mailing list at WSMR-SimTel20. The full list of
2 perry 1219 contributors to !UnZip has grown quite large; please refer to
1220 the CONTRIBS file in the !UnZip source distribution for a
1 perry 1221 relatively complete version.
1222 !!VERSIONS
1223
1224
1225 v1.2 15 Mar 89
1226
1227
1228 Samuel H. Smith
1229
1230
1231 v2.0 9 Sep 89
1232
1233
1234 Samuel H. Smith
1235
1236
1237 v2.x fall 1989
1238
1239
1240 many Usenet contributors
1241
1242
1243 v3.0 1 May 90
1244
1245
1246 Info-ZIP (DPK, consolidator)
1247
1248
1249 v3.1 15 Aug 90
1250
1251
1252 Info-ZIP (DPK, consolidator)
1253
1254
1255 v4.0 1 Dec 90
1256
1257
1258 Info-ZIP (GRR, maintainer)
1259
1260
1261 v4.1 12 May 91
1262
1263
1264 Info-ZIP
1265
1266
1267 v4.2 20 Mar 92
1268
1269
1270 Info-ZIP (Zip-Bugs subgroup, GRR)
1271
1272
1273 v5.0 21 Aug 92
1274
1275
1276 Info-ZIP (Zip-Bugs subgroup, GRR)
1277
1278
1279 v5.01 15 Jan 93
1280
1281
1282 Info-ZIP (Zip-Bugs subgroup, GRR)
1283
1284
1285 v5.1 7 Feb 94
1286
1287
1288 Info-ZIP (Zip-Bugs subgroup, GRR)
1289
1290
1291 v5.11 2 Aug 94
1292
1293
1294 Info-ZIP (Zip-Bugs subgroup, GRR)
1295
1296
1297 v5.12 28 Aug 94
1298
1299
1300 Info-ZIP (Zip-Bugs subgroup, GRR)
1301
1302
1303 v5.2 30 Apr 96
1304
1305
1306 Info-ZIP (Zip-Bugs subgroup, GRR)
1307
1308
1309 v5.3 22 Apr 97
1310
1311
1312 Info-ZIP (Zip-Bugs subgroup, GRR)
1313
1314
1315 v5.31 31 May 97
1316
1317
1318 Info-ZIP (Zip-Bugs subgroup, GRR)
1319
1320
1321 v5.32 3 Nov 97
1322
1323
1324 Info-ZIP (Zip-Bugs subgroup, GRR)
1325
1326
1327 v5.4 28 Nov 98
1328
1329
1330 Info-ZIP (Zip-Bugs subgroup, SPC)
1331
1332
1333 v5.41 16 Apr 00
1334
1335
1336 Info-ZIP (Zip-Bugs subgroup, SPC)
1337
1338
1339 v5.42 14 Jan 01
1340
1341
1342 Info-ZIP (Zip-Bugs subgroup, SPC)
1343
1344
1345 v5.5 17 Feb 02
1346
1347
1348 Info-ZIP (Zip-Bugs subgroup, SPC)
1349 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.