📄 unzip_man.txt
字号:
UNZIP(1L) UNZIP(1L)
NAME
unzip - list, test and extract compressed files in a ZIP
archive
SYNOPSIS
unzip [-Z] [-cflptTuvz[abjnoqsCKLMVWX$/:]] 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 (and subdirectories below it) all files from the
specified ZIP archive. A companion program, zip(1L), cre-
ates ZIP archives; both programs are compatible with
archives created by PKWARE's PKZIP and PKUNZIP for MS-DOS,
but in many cases the program options or default behaviors
differ.
ARGUMENTS
file[.zip]
Path of the ZIP archive(s). If the file specifica-
tion 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 those supported in commonly used Unix
shells (sh, ksh, csh) 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). To specify a verbatim
left bracket, the three-character sequence
``[[]'' has to be used.
(Be sure to quote any character that might other-
wise 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, as with any other ZIP
archive; just specify the .exe suffix (if any)
explicitly.
Info-ZIP 28 February 2005 (v5.52) 1
UNZIP(1L) UNZIP(1L)
[file(s)]
An optional list of archive members to be pro-
cessed, separated by spaces. (VMS versions com-
piled with VMSCLI defined must delimit files with
commas instead. See -v in OPTIONS below.) Regular
expressions (wildcards) may be used to match multi-
ple 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 nor-
mally match (`/') directory separators (for exep-
tions see the option -W, this option may be used to
exclude any files that 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 zip-
file would be extracted.
[-d exdir]
An optional directory to which to extract files.
By default, all files and subdirectories are recre-
ated in the current directory; the -d option allows
extraction in an arbitrary directory (always assum-
ing one has permission to write to the directory).
This option need not appear at the end of the com-
mand line; it is also accepted before the zipfile
specification (with the normal options), immedi-
ately after the zipfile specification, or between
the file(s) and the -x option. The option and
directory may be concatenated without any white
space between them, but note that this may cause
normal shell behavior to be suppressed. In partic-
ular, ``-d ~'' (tilde) is expanded by Unix C shells
into the name of the user's home directory, but
``-d~'' is treated as a literal subdirectory ``~''
of the current directory.
OPTIONS
Note that, in order to support obsolescent hardware,
unzip's usage screen is limited to 22 or 23 lines and
should therefore be considered only a reminder of the
basic unzip syntax rather than an exhaustive list of all
possible flags. The exhaustive list follows:
-Z zipinfo(1L) mode. If the first option on the com-
mand line is -Z, the remaining options are taken to
be zipinfo(1L) options. See the appropriate manual
page for a description of these options.
-A [OS/2, Unix DLL] print extended help for the DLL's
Info-ZIP 28 February 2005 (v5.52) 2
UNZIP(1L) UNZIP(1L)
programming interface (API).
-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 conver-
sion is automatically performed if appropriate.
This option is not listed in the unzip usage
screen.
-f freshen existing files, i.e., extract only those
files that already exist on disk and that are newer
than the disk copies. By default unzip queries
before overwriting, but the -o option may be used
to suppress the queries. Note that under many
operating systems, the TZ (timezone) environment
variable must be set correctly in order for -f and
-u to work properly (under Unix the variable is
usually set automatically). The reasons for this
are somewhat subtle but have to do with the differ-
ences between DOS-format file times (always local
time) and Unix-format times (always in GMT/UTC) and
the necessity to compare the two. A typical TZ
value is ``PST8PDT'' (US Pacific time with auto-
matic adjustment for Daylight Savings Time or
``summer time'').
-l list archive files (short format). The names,
uncompressed file sizes and modification dates and
times of the specified files are printed, along
with totals for all files specified. If UnZip was
compiled with OS2_EAS defined, the -l option also
lists columns for the sizes of stored OS/2 extended
attributes (EAs) and OS/2 access control lists
(ACLs). In addition, the zipfile comment and indi-
vidual file comments (if any) are displayed. If a
file was archived from a single-case file system
(for example, the old MS-DOS FAT file system) and
the -L option was 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
(cyclic redundancy check, an enhanced checksum) of
the expanded file with the original file's stored
CRC value.
-T [most OSes] set the timestamp on the archive(s) to
that of the newest file in each one. This
Info-ZIP 28 February 2005 (v5.52) 3
UNZIP(1L) UNZIP(1L)
corresponds to zip's -go option except that it can
be used on wildcard zipfiles (e.g., ``unzip -T
\*.zip'') and is much faster.
-u update existing files and create new ones if
needed. This option performs the same function as
the -f option, extracting (with query) files that
are newer than those with the same name on disk,
and in addition it extracts those files that do not
already exist on disk. See -f above for informa-
tion on setting the timezone properly.
-v be verbose or print diagnostic version info. This
option has evolved and now behaves as both an
option and a modifier. As an option it has two
purposes: when a zipfile is specified with no
other options, -v lists archive files verbosely,
adding to the basic -l info the compression method,
compressed size, compression ratio and 32-bit CRC.
In contrast to most of the competing utilities,
unzip removes the 12 additional header bytes of
encrypted entries from the compressed size numbers.
Therefore, compressed size and compression ratio
figures are independent of the entry's encryption
status and show the correct compression perfor-
mance. (The complete size of the encryped com-
pressed data stream for zipfile entries is reported
by the more verbose zipinfo(1L) reports, see the
separate manual.) When no zipfile is specified
(that is, the complete command is simply ``unzip
-v''), a diagnostic screen is printed. In addition
to the normal header with release date and version,
unzip lists the home Info-ZIP ftp site and where to
find a list of other ftp and non-ftp sites; the
target operating system for which it was compiled,
as well as (possibly) the hardware on which it was
compiled, the compiler and version used, and the
compilation date; any special compilation options
that might affect the program's operation (see also
DECRYPTION below); and any options stored in envi-
ronment variables that might do the same (see ENVI-
RONMENT OPTIONS below). As a modifier it works in
conjunction with other options (e.g., -t) to pro-
duce more verbose or debugging output; this is not
yet fully implemented but will be in future
releases.
-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
Info-ZIP 28 February 2005 (v5.52) 4
UNZIP(1L) UNZIP(1L)
zipinfo listings, rather than `b') to be automati-
cally 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 most PC operating sys-
tems 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. unzip therefore prints ``[text]''
or ``[binary]'' as a visual check for each file it
extracts when using the -a option. The -aa option
forces all files to be extracted as text, regard-
less of the supposed file type.
-b [general] treat all files as binary (no text con-
versions). This is a shortcut for ---a.
-b [Tandem] force the creation files with filecode
type 180 ('C') when extracting Zip entries marked
as "text". (On Tandem, -a is enabled by default,
see above).
-b [VMS] auto-convert binary files (see -a above) to
fixed-length, 512-byte record format. Doubling the
option (-bb) forces all files to be extracted in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -