UNZIP(1)
NAME
unzip − list/test/extract from a ZIP archive file
SYNOPSIS
unzip [ −cflptuvxz[ajnoqUV] ] file[.zip] [filespec ...]
ARGUMENTS
file[.zip]Path of the ZIP archive. The suffix “.zip” is applied if the file specified does not exist. Note that self-extracting ZIP files are supported; just specify the “.exe” suffix yourself.
[filespec]An optional list of archive members to be processed. Expressions may be used to match multiple members; be sure to quote expressions that contain characters interpreted by the operating system. See DESCRIPTION (below) for more details.
OPTIONS
−cextract files to stdout/screen (“CRT”)
−ffreshen existing files (replace if newer); create none
−llist archive files (short format)
−pextract files to pipe; no informational messages
−ttest archive files
−uupdate existing files; create new ones if needed
−vlist archive files (verbose format)
−xextract files in archive (default)
−zdisplay only the archive comment
MODIFIERS
−aconvert to MS-DOS textfile format (CR LF), Mac format (CR), Unix/VMS format (LF), OR from ASCII to EBCDIC, depending on your system (only use for TEXT files!)
−jjunk paths (don’t recreate archive’s directory structure)
−nnever overwrite existing files; don’t prompt
−oOK to overwrite files without prompting
−qperform operations quietly (−qq ☞ even quieter)
−s[OS/2, MS-DOS] allow spaces in filenames (e.g., “EA DATA. SF”)
−Uleave filenames uppercase if created under MS-DOS, VMS, etc.
−Vretain (VMS) file version numbers
−X[VMS] restore owner/protection info (may require privileges)
DESCRIPTION
UnZip will list, test, or extract from a ZIP archive, commonly found on MSDOS systems. Archive member extraction is implied by the absence of the −c, −p, −t, −l, −v or −z options. All archive members are processed unless a filespec is provided to specify a subset of the archive members. The filespec is similar to an egrep expression, and may contain: *matches a sequence of 0 or more characters
?matches exactly 1 character
\nnnmatches the character having octal code nnn
[...]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 carat (‘!’ or ‘^’) follows the left bracket, then the range of characters matched is complemented with respect to the ASCII character set (that is, anything except the characters inside the brackets is considered a match).
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 -qqUnix C shell
UNZIP=-qq; export UNZIPUnix Bourne shell
set UNZIP=-qqOS/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 to the current directory:
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(1), zip(1), zipcloak(1), zipinfo(1), zipnote(1), zipsplit(1)
AUTHORS
Samuel H. Smith, Carl Mascott, David P. Kirschbaum, Greg R. Roelofs, Mark Adler, Kai Uwe Rommel, Igor Mandrichenko, Johnny Lee, Jean-loup Gailly; Glenn Andrews, Joel Aycock, Allan Bjorklund, James Birdsall, Wim Bonner, John Cowan, Frank da Cruz, Bill Davidsen, Arjan de Vet, James Dugal, Jim Dumser, Mark Edwards, David Feinleib, Mike Freeman, Hunter Goatley, Robert Heath, Dave Heiland, Larry Jones, Kjetil J(o)rgenson, Bob Kemp, J. Kercheval, Alvin Koh, Bo Kullmar, Johnny Lee, Warner Losh, Fulvio Marino, Gene McManus, Joe Meadows, Mike O’Carroll, Humberto Ortiz-Zuazaga, Piet W. Plomp, Antonio Querubin Jr., Steve Salisbury, Georg Sassen, Jon Saxton, Hugh Schmidt, Martin Schulz, Charles Scripter, Chris Seaman, Richard Seay, Alex Sergejew, Cliff Stanford, Onno van der Linden, Jim Van Zandt, Antoine Verheijen, Paul Wells.
VERSIONS
v1.215 Mar 89
Samuel H. Smith
v2.0 9 Sep 89Samuel H. Smith
v2.xfall 1989many Usenet contributors
v3.0 1 May 90Info-ZIP (DPK, consolidator)
v3.115 Aug 90
Info-ZIP (DPK, consolidator)
v4.0 1 Dec 90Info-ZIP (GRR, maintainer)
v4.112 May 91
Info-ZIP
v4.220 Mar 92
Info-ZIP (zip-bugs subgroup; GRR, maint.)
v5.021 Aug 92
Info-ZIP (zip-bugs subgroup; GRR, maint.)