unzip - Unix, Linux Command

"*.c" matches "foo.c" but not "mydir/foo.c"
    "**.c" matches both "foo.c" and "mydir/foo.c"
    "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
    "??*/*" matches "ab/foo" and "abc/foo"
            but not "a/foo" or "a/b/foo"




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 one quantum of quietness.  To cancel
both quiet flags, two (or more) minuses may be used:




unzip -t--q zipfile
unzip ---qt 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).


As suggested by the examples above, the default variable names are UNZIP_OPTS
for VMS (where the symbol used to install unzip as a foreign command
would otherwise be confused with the environment variable), and UNZIP
for all other operating systems.  For compatibility with zip(1L),
UNZIPOPT is also accepted (don’t ask).  If both UNZIP and UNZIPOPT
are defined, however, UNZIP takes precedence.  unzip’s diagnostic
option (-v with no zipfile name) can be used to check the values
of all four possible unzip and zipinfo environment variables.


The timezone variable (TZ) should be set according to the local timezone
in order for the -f and -u to operate correctly.  See the
description of -f above for details.  This variable may also be
necessary to get timestamps of extracted files to be set correctly.
The WIN32 (Win9x/ME/NT4/2K/XP/2K3) port of unzip gets the timezone
configuration from the registry, assuming it is correctly set in the
Control Panel.  The TZ variable is ignored for this port.


Some compiled versions of unzip may not support decryption.
To check a version for crypt support, either attempt to test or extract
an encrypted archive, or else check unzip’s diagnostic
screen (see the -v option above) for ‘‘[decryption]’’ as one
of the special compilation options.


As noted above, the -P option may be used to supply a password on
the command line, but at a cost in security.  The preferred decryption
method is simply to extract normally; if a zipfile member is encrypted,
unzip will prompt for the password without echoing what is typed.
unzip continues to use the same password as long as it appears to be
valid, by testing a 12-byte header on each file.  The correct password will
always check out against the header, but there is a 1-in-256 chance that an
incorrect password will as well.  (This is a security feature of the PKWARE
zipfile format; it helps prevent brute-force attacks that might otherwise
gain a large speed advantage by testing only the header.)  In the case that
an incorrect password is given but it passes the header test anyway, either
an incorrect CRC will be generated for the extracted data or else unzip
will fail during the extraction because the ‘‘decrypted’’ bytes do not
constitute a valid compressed data stream.


If the first password fails the header check on some file, unzip will
prompt for another password, and so on until all files are extracted.  If
a password is not known, entering a null password (that is, just a carriage
return or ‘‘Enter’’) is taken as a signal to skip all further prompting.
Only unencrypted files in the archive(s) will thereafter be extracted.  (In
fact, that’s not quite true; older versions of zip(1L) and
zipcloak(1L) allowed null passwords, so unzip checks each encrypted
file to see if the null password works.  This may result in ‘‘false positives’’
and extraction errors, as noted above.)


Archives encrypted with 8-bit passwords (for example, passwords with accented
European characters) may not be portable across systems and/or other
archivers.  This problem stems from the use of multiple encoding methods for
such characters, including Latin-1 (ISO 8859-1) and OEM code page 850.  DOS
PKZIP 2.04g uses the OEM code page; Windows PKZIP 2.50 uses
Latin-1 (and is therefore incompatible with DOS PKZIP); Info-ZIP uses
the OEM code page on DOS, OS/2 and Win3.x ports but Latin-1 everywhere
else; and Nico Mak’s WinZip 6.x does not allow 8-bit passwords at all.
UnZip 5.3 (or newer) attempts to use the default character set first
(e.g., Latin-1), followed by the alternate one (e.g., OEM code page) to test
passwords.  On EBCDIC systems, if both of these fail, EBCDIC encoding will
be tested as a last resort.  (EBCDIC is not tested on non-EBCDIC systems,
because there are no known archivers that encrypt using EBCDIC encoding.)
ISO character encodings other than Latin-1 are not supported.




unzip letters


To extract all members of letters.zip into the current directory only:




unzip -j letters


To test letters.zip, printing only a summary message indicating
whether the archive is OK or not:




unzip -tq letters


To test all zipfiles in the current directory, printing only the
summaries:




unzip -tq \*.zip


(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 examples below.)  To extract to standard output all members of
letters.zip whose names end in .tex, auto-converting to the
local end-of-line convention and piping the output into more(1):




unzip -ca letters \*.tex | more


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, and Makefile--into
the /tmp directory:




unzip source.zip "*.[fch]" Makefile -d /tmp


(the double quotes are necessary only in Unix and only if globbing is turned
on).  To extract all FORTRAN and C source files, regardless of case (e.g.,
both *.c and *.C, and any makefile, Makefile, MAKEFILE or similar):




unzip -C source.zip "*.[fch]" makefile -d /tmp


To extract any such files but convert any uppercase MS-DOS or VMS names to
lowercase and convert the line-endings of all of the files to the local
standard (without respect to any files that might be marked ‘‘binary’’):




unzip -aaCL source.zip "*.[fch]" makefile -d /tmp


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 other than those created by Zip 2.1
or later 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


To display a diagnostic screen showing which unzip and zipinfo
options are stored in environment variables, whether decryption support was
compiled in, the compiler with which unzip was compiled, etc.:




unzip -v


In the last five examples, assume that UNZIP or UNZIP_OPTS is set to -q.
To do a singly quiet listing:




unzip -l file.zip


To do a doubly quiet listing:




unzip -ql file.zip


(Note that the ‘‘.zip’’ is generally not necessary.)  To do a standard
listing:




unzip --ql file.zip

unzip -l-q file.zip

unzip -l--q file.zip


The maintainer also finds it useful to set the UNZIP environment variable
to ‘‘-aL’’ and is tempted to add ‘‘-C’’ as well.  His ZIPINFO
variable is set to ‘‘-z’’.


VMS interprets standard Unix (or PC) return values as other, scarier-looking
things, so unzip instead maps them into VMS-style status codes.  The
current mapping is as follows:   1 (success) for normal exit, 0x7fff0001
for warning errors, and (0x7fff000? + 16*normal_unzip_exit_status) for all
other errors, where the ‘?’ is 2 (error) for unzip values 2, 9-11 and
80-82, and 4 (fatal error) for the remaining ones (3-8, 50, 51).  In addition,
there is a compilation option to expand upon this behavior:  defining
RETURN_CODES results in a human-readable explanation of what the error
status means.


Archives read from standard input are not yet supported, except with
funzip (and then only the first member of the archive can be extracted).


Archives encrypted with 8-bit passwords (e.g., passwords with accented
European characters) may not be portable across systems and/or other
archivers.  See the discussion in DECRYPTION above.


unzip’s -M (‘‘more’’) option tries to take into account automatic
wrapping of long lines. However, the code may fail to detect the correct
wrapping locations. First, TAB characters (and similar control sequences) are
not taken into account, they are handled as ordinary printable characters.
Second, depending on the actual system / OS port, unzip may not detect
the true screen geometry but rather rely on "commonly used" default dimensions.
The correct handling of tabs would require the implementation of a query for
the actual tabulator setup on the output console.


Dates, times and permissions of stored directories are not restored except
under Unix. (On Windows NT and successors, timestamps are now restored.)


[MS-DOS] When extracting or testing files from an archive on a defective
floppy diskette, if the ‘‘Fail’’ option is chosen from DOS’s ‘‘Abort, Retry,
Fail?’’ message, older versions of unzip may hang the system, requiring
a reboot.  This problem appears to be fixed, but control-C (or control-Break)
can still be used to terminate unzip.


Under DEC Ultrix, unzip would sometimes fail on long zipfiles (bad CRC,
not always reproducible).  This was apparently due either to a hardware bug
(cache memory) or an operating system bug (improper handling of page faults?).
Since Ultrix has been abandoned in favor of Digital Unix (OSF/1), this may not
be an issue anymore.


[Unix] Unix special files such as FIFO buffers (named pipes), block devices
and character devices are not restored even if they are somehow represented
in the zipfile, nor are hard-linked files relinked.  Basically the only file
types restored by unzip are regular files, directories and symbolic
(soft) links.


[OS/2] Extended attributes for existing directories are only updated if the
-o (‘‘overwrite all’’) option is given.  This is a limitation of the
operating system; because directories only have a creation time associated
with them, unzip has no way to determine whether the stored attributes
are newer or older than those on disk.  In practice this may mean a two-pass
approach is required:  first unpack the archive normally (with or without
freshening/updating existing files), then overwrite just the directory entries
(e.g., ‘‘unzip -o foo */’’).


[VMS] When extracting to another directory, only the [.foo] syntax is
accepted for the -d option; the simple Unix foo syntax is
silently ignored (as is the less common VMS foo.dir syntax).


[VMS] When the file being extracted already exists, unzip’s query only
allows skipping, overwriting or renaming; there should additionally be a
choice for creating a new version of the file.  In fact, the ‘‘overwrite’’
choice does create a new version; the old version is not overwritten or
deleted.

http://www.info-zip.org/pub/infozip/

ftp://ftp.info-zip.org/pub/infozip/ .


The following people were former members of the Info-ZIP development group
and provided major contributions to key parts of the current code:
Greg ‘‘Cave Newt’’ Roelofs (UnZip, unshrink decompression);
Jean-loup Gailly (deflate compression);
Mark Adler (inflate decompression, fUnZip).


The author of the original unzip code upon which Info-ZIP’s was based
is Samuel H. Smith; Carl Mascott did the first Unix port; and David P.
Kirschbaum organized and led Info-ZIP in its early days with Keith Petersen
hosting the original mailing list at WSMR-SimTel20.  The full list of
contributors to UnZip has grown quite large; please refer to the CONTRIBS
file in the UnZip source distribution for a relatively complete version.


Advertisements


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page