unzip.txt 54 KB

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