UNZIP
Section: Misc. Reference Manual Pages (1L)
Updated: 23 Jan 94 (v5.1)
Index
Return to Main Contents
NAME
unzip - list, test and extract a ZIP archive file
SYNOPSIS
unzip [-cflptuvxz[ajnoqUV]] file[.zip]
[file(s) ...] [-x xfile(s) ...]
[-d exdir]
DESCRIPTION
unzip will list, test, or extract files from a ZIP archive, commonly
found on MS-DOS systems. The default behavior (with no options) is to extract
into the current directory all files from the specified ZIP archive, recreating
the stored subdirectory structure if it exists.
A companion program, zip(1L), creates ZIP archives; both programs are
compatible with PKWARE's PKZIP and PKUNZIP for MS-DOS.
ARGUMENTS
- file[.zip]
-
Path of the ZIP archive(s). If the file specification is a wildcard,
each matching file is processed in an order determined by the operating
system (or file system). Only the filename can be a wildcard; the path
itself cannot. Wildcard expressions are similar to Unix egrep (regular)
expressions and may contain:
-
- *
-
matches a sequence of 0 or more characters
- ?
-
matches exactly 1 character
- [...]
-
matches any single character found inside the brackets; ranges
are specified by a beginning character, a hyphen, and an ending
character. If an exclamation point or a caret (`!' or `^') follows
the left bracket, then the range of characters within the brackets is
complemented (that is, anything except the characters inside the
brackets is considered a match).
-
(Be sure to quote any character which might otherwise be interpreted or
modified by the operating system, particularly under Unix and VMS.)
If no matches are found, the specification is assumed to be a literal
filename; and if that also fails, the suffix .zip is appended.
Note that self-extracting ZIP files are supported; just specify the .exe
suffix explicitly.
- [file(s)]
-
An optional list of archive members to be processed.
Regular expressions (wildcards) may be used to match multiple members; see
above. Again, be sure to quote expressions that would otherwise be expanded
or modified by the operating system.)
- [-x xfile(s)]
-
An optional list of archive members to be excluded from processing.
Since wildcard characters match directory separators (`/'), this option
may be used to exclude any files which are in subdirectories. For
example, ``unzip foo *.[ch] -x */*'' would extract all C source files
in the main directory, but none in any subdirectories. Without the -x
option, all C source files in all directories within the zipfile would be
extracted.
- [-d exdir]
-
An optional directory to which to extract files. By default, all files
and subdirectories are recreated in the current directory; the -d
option allows extraction in an arbitrary directory (always assuming one
has permission to write to the directory). This option need not appear
at the end of the command line; it is also accepted immediately after the
zipfile specification, or between the file(s) and the -x
option. Under VMS, the directory must currently be specified in ``[.foo]''
format rather than ``foo.dir'' or ``foo/'' format.
OPTIONS
- -c
-
extract files to stdout/screen (``CRT''). This option is similar to the
-p option except that the name of each file is printed as it is
extracted, the -a option is allowed, and ASCII-EBCDIC conversion
is automatically performed if appropriate.
- -f
-
freshen existing files. This option extracts only those files which
already exist on disk and which are newer than the disk copies. By
default unzip queries before overwriting, but the -o option
may be used to suppress the queries.
- -l
-
list archive files (short format). The name, uncompressed file size and
modification date and time of each specified file is printed, along
with totals for all files specified. If a file was archived from a
single-case file system (for example, the MS-DOS FAT file system) and
the -U option was not given, the filename is converted to
lowercase and is prefixed with a caret (^).
- -p
-
extract files to pipe (stdout). Nothing but the file data is sent to
stdout, and the files are always extracted in binary format, just as they
are stored (no conversions).
- -t
-
test archive files. This option extracts each specified file in memory
and compares the CRC value of the expanded file with the original file's
stored CRC value.
- -u
-
update existing files and create new ones if needed. This option performs
the same function as the -f option, extracting (with query) files
which are newer than those with the same name on disk, and in addition it
extracts those files which do not already exist on disk.
- -v
-
list archive files (verbose format)
- -x
-
extract files in archive (default)
- -z
-
display only the archive comment
MODIFIERS
- -a
-
convert text files. Ordinarily all files are extracted exactly as they
are stored (as ``binary'' files). The -a option causes files
identified by Zip as text files (those with the `t' label in ZipInfo
listings, rather than `b') to be automatically extracted as such, converting
line endings, end-of-file characters and the character set itself as necessary.
(For example, Unix files use line feeds (LFs) for end-of-line (EOL) and
have no end-of-file (EOF) marker; Macintoshes use carriage returns (CRs)
for EOLs; and PC operating systems use CR+LF for EOLs and control-Z for EOF.
In addition, IBM mainframes and the Michigan Terminal System use EBCDIC
rather than the more common ASCII character set, and NT supports Unicode.)
Note that Zip's identification of text files is by no means perfect; some
``text'' files may actually be binary and vice versa. The -aa option
forces all files to be extracted as text, regardless of the supposed file
type.
- -j
-
junk paths. The archive's directory structure is not recreated; all files
are deposited in the extraction directory (by default, the current one).
- -n
-
never overwrite existing files. If a file already exists, skip the extraction
of that file without prompting.
- -o
-
overwrite files without prompting. If a file already exists, overwrite it
without prompting. This is a dangerous option, so use it with care.
- -q
-
perform operations quietly (-qq = even quieter). Ordinarily unzip
prints the name of the file it's extracting and the extraction method,
along with any file or zipfile comments which may be stored in the archive
and possibly a summary when finished with each archive. The -q[q]
options suppress the printing of some or all of these messages.
- -s
-
[OS/2, NT, MS-DOS] convert spaces in filenames to underscores. Since all PC
operating systems allow spaces in filenames, unzip by default extracts
filenames with spaces intact (e.g., ``EA DATA. SF''). This can be awkward,
however, since MS-DOS in particular does not gracefully support spaces in
filenames. Conversion of spaces to underscores can eliminate the awkwardness
in some cases.
- -U
-
leave filenames uppercase if created under MS-DOS, VMS, etc. Depending on
the archiver, files archived under single-case filesystems may be stored as
all-uppercase names; this can be awkward when extracting to a case-preserving
filesystem such as OS/2 HPFS or a case-sensitive one such as under Unix. By
default unzip converts such filenames to lowercase; this option causes all
filenames to be extracted exactly as they're stored (excepting truncation,
conversion of unsupported characters, etc.).
- -V
-
retain (VMS) file version numbers. VMS files can be stored with a version
number, in the format ``file.exe;##''. By default the ``;##'' version numbers
are stripped, but this option allows them to be retained.
- -X
-
[VMS] restore owner/protection info (may require system privileges). Ordinary
file attributes are always restored, but this option allows UICs to be restored
as well. [The next version of unzip will support Unix UID/GID info as well,
and possibly NT permissions.]
- -$
-
[MS-DOS, OS/2, NT, Amiga] restore the volume label if the extraction medium is
removable (e.g., a diskette). Doubling the option (-$$) allows fixed
media (hard disks) to be labelled as well. By default, volume labels are
ignored.
ENVIRONMENT OPTIONS
unzip's default behavior may be modified via options placed in
an environment variable. This can be done with any option, but it
is probably most useful with the
-q, -o, or -n modifiers: in order to make unzip quieter by
default, or to make it always overwrite or never overwrite files as it
extracts them. For example, to
make unzip act as quietly as possible, only reporting errors, one would
use one of the following commands:
-
setenv UNZIP -qq Unix C shell
UNZIP=-qq; export UNZIP Unix Bourne shell
set UNZIP=-qq OS/2 or MS-DOS
define UNZIP_OPTS ""-qq"" VMS (quotes for lowercase)
Environment options are, in effect, considered to be just like any other
command-line options, except that they are effectively the first options
on the command line. To override
an environment option, one may use the ``minus operator'' to remove it. For
instance, to override one of the quiet-flags in the example above, use the
command
- unzip --q[other options] zipfile
-
The first hyphen is the normal
switch character, and the second is a minus sign, acting on the q option.
Thus the effect here is to cancel a single quantum of quietness. To cancel
both quiet flags, two (or more) minuses may be used:
- unzip -x--q zipfile
-
or
- unzip ---qx zipfile
-
(the two are equivalent). This may seem awkward
or confusing, but it is reasonably intuitive: just ignore the first
hyphen and go from there. It is also consistent with the behavior of Unix
nice(1).
EXAMPLES
To use unzip to extract all members of the archive letters.zip,
creating any directories as necessary:
- unzip letters
-
To extract all members of letters.zip into the current directory, ignoring
any stored subdirectory information:
- unzip -j letters
-
To test letters.zip, printing only a summary message indicating
whether the archive is OK or not:
- unzip -tq letters
-
To extract to standard output all members of letters.zip whose names end
in ``.tex'', converting to the local end-of-line convention and piping the
output into more(1):
- unzip -ca letters \*.tex | more
-
(The backslash before the asterisk is only required if the shell expands
wildcards, as in Unix; double quotes could have been used instead, as in
the source example below.) To extract the binary file paper1.dvi to
standard output and pipe it to a printing program:
- unzip -p articles paper1.dvi | dvips
-
To extract all FORTRAN and C source files--*.f, *.c, *.h, Makefile (the
double quotes are necessary only in Unix and only if globbing is turned on):
- unzip source.zip *.[fch] Makefile
-
To extract only newer versions of the files already in the current directory,
without querying (NOTE: be careful of unzipping in one timezone a zipfile
created in another--ZIP archives contain no timezone information, and a
``newer'' file from an eastern timezone may, in fact, be older):
- unzip -fo sources
-
To extract newer versions of the files already in the current directory and
to create any files not already there (same caveat as previous example):
- unzip -uo sources
-
In the last five examples, assume that UNZIP or UNZIP_OPTS is set to -q.
To do a singly quiet listing:
- unzip -l file
-
To do a doubly quiet listing:
- unzip -ql file
-
To do a standard listing:
- unzip --ql file
-
or
- unzip -l-q file
-
or
- unzip -l--q file
-
(extra minuses don't hurt).
TIPS
The current maintainer, being a lazy sort, finds it very useful to define
an alias ``tt'' for ``unzip -tq''. One may then simply type ``tt zipfile''
to test the archive, something which one ought make a habit of doing.
With luck unzip will report ``No errors detected in zipfile.zip,''
after which one may breathe a sigh of relief.
SEE ALSO
funzip(1L), zip(1L), zipcloak(1L), zipgrep(1L),
zipinfo(1L), zipnote(1L), zipsplit(1L)
AUTHORS
The primary Info-ZIP authors (current zip-bugs workgroup) are: Jean-loup
Gailly (Zip), Greg R. Roelofs (UnZip), Mark Adler (decompression, fUnZip),
Kai Uwe Rommel (OS/2), Igor Mandrichenko (VMS), John Bush and Paul Kienitz
(Amiga), Antoine Verheijen (Macintosh), Chris Herborth (Atari), Henry
Gessau (NT), and Robert Heath (Windows). The author of the original unzip
code upon which Info-ZIP's is based was Samuel H. Smith; Carl Mascott
did the first Unix port; and David P. Kirschbaum organized and led Info-ZIP
in its early days. The full list of contributors to UnZip has grown quite
large; please refer to the CONTRIBS file in the UnZip source distribution
for a more complete list.
VERSIONS
- v1.2 15 Mar 89
-
Samuel H. Smith
- v2.0 9 Sep 89
-
Samuel H. Smith
- v2.x fall 1989
-
many Usenet contributors
- v3.0 1 May 90
-
Info-ZIP (DPK, consolidator)
- v3.1 15 Aug 90
-
Info-ZIP (DPK, consolidator)
- v4.0 1 Dec 90
-
Info-ZIP (GRR, maintainer)
- v4.1 12 May 91
-
Info-ZIP
- v4.2 20 Mar 92
-
Info-ZIP (zip-bugs subgroup; GRR, maint.)
- v5.0 21 Aug 92
-
Info-ZIP (zip-bugs subgroup; GRR, maint.)
- v5.1 30 Jan 94
-
Info-ZIP (zip-bugs subgroup; GRR, maint.)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- ARGUMENTS
-
- OPTIONS
-
- MODIFIERS
-
- ENVIRONMENT OPTIONS
-
- EXAMPLES
-
- TIPS
-
- SEE ALSO
-
- AUTHORS
-
- VERSIONS
-
This document was created by
man2html,
using the manual pages.
Time: 10:12:55 GMT, January 08, 2023