~ubuntu-branches/ubuntu/precise/unzip/precise-proposed

« back to all changes in this revision

Viewing changes to man/unzip.1

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-06-06 17:57:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040606175746-nl7p2dgp3aobyc2c
Tags: upstream-5.51
ImportĀ upstreamĀ versionĀ 5.51

Show diffs side-by-side

added added

removed removed

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