man unzip Command

Man page for apt-get unzip Command

Man Page for unzip in Linux

Ubuntu Man Command : man unzip

Man Unzip  Command

This tutorial shows the man page for man unzip in linux.

Open terminal with 'su' access and type the command as shown below:
man unzip

Result of the Command Execution shown below:

UNZIP(1)                                                              UNZIP(1)

unzip list, test and extract compressed files in a ZIP archive

unzip [ Z] [ cflptTuvz[abjnoqsCDKLMUVWX$/:^]] file[.zip] [file(s) ...]
[ x xfile(s) ...] [ d exdir]

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(1),
creates ZIP archives; both programs are compatible with archives cre
ated by PKWARE's PKZIP and PKUNZIP for MS DOS, but in many cases the
program options or default behaviors differ.

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 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 otherwise be inter
preted 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.

An optional list of archive members to be processed, separated
by spaces. (VMS versions compiled with VMSCLI defined must
delimit files with commas instead. See v in OPTIONS below.)
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 process
ing. Since wildcard characters normally match (`/') directory
separators (for exceptions 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 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 direc
tory; 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 before the zipfile specification (with the nor
mal options), immediately 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 particular, `` 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 direc

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(1) mode. If the first option on the command line is Z,
the remaining options are taken to be zipinfo(1) options. See
the appropriate manual page for a description of these options.

A [OS/2, Unix DLL] print extended help for the DLL's programming
interface (API).

c extract files to stdout/screen (``CRT''). This option is simi
lar 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.
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 oper
ating 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 differences
between DOS format file times (always local time) and Unix for
mat times (always in GMT/UTC) and the necessity to compare the
two. A typical TZ value is ``PST8PDT'' (US Pacific time with
automatic adjustment for Daylight Savings Time or ``summer

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 individual file comments (if any) are dis
played. 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 pre
fixed 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 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 information on setting
the timezone properly.

v list archive files (verbose format) or show 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 zip
file 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 addi
tional 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 performance. (The complete size of
the encrypted compressed data stream for zipfile entries is
reported by the more verbose zipinfo(1) reports, see the sepa
rate manual.) When no zipfile is specified (that is, the com
plete 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 environment variables that
might do the same (see ENVIRONMENT OPTIONS below). As a modi
fier it works in conjunction with other options (e.g., t) to
produce more verbose or debugging output; this is not yet fully
implemented but will be in future releases.

z display only the archive comment.

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 charac
ters 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 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. 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, regardless of
the supposed file type. On VMS, see also S.

b [general] treat all files as binary (no text conversions). 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 this format. When extracting to stan
dard output ( c or p option in effect), the default conversion
of text record delimiters is disabled for binary ( b) resp. all
( bb) files.

B [when compiled with UNIXBACKUP defined] save a backup copy of
each overwritten file. The backup file is gets the name of the
target file with a tilde and optionally a unique sequence number
(up to 5 digits) appended. The sequence number is applied when
ever another file with the original name plus tilde already
exists. When used together with the "overwrite all" option o,
numbered backup files are never created. In this case, all
backup files are named as the original file with an appended
tilde, existing backup files are deleted without notice. This
feature works similarly to the default behavior of emacs(1) in
many locations.

Example: the old copy of ``foo'' is renamed to ``foo~''.

Warning: Users should be aware that the B option does not pre
vent loss of existing data under all circumstances. For exam
ple, when unzip is run in overwrite all mode, an existing
``foo~'' file is deleted before unzip attempts to rename ``foo''
to ``foo~''. When this rename attempt fails (because of a file
locks, insufficient privileges, or ...), the extraction of
``foo~'' gets cancelled, but the old backup file is already
lost. A similar scenario takes place when the sequence number
range for numbered backup files gets exhausted (99999, or 65535
for 16 bit systems). In this case, the backup file with the
maximum sequence number is deleted and replaced by the new
backup version without notice.

C use case insensitive matching for the selection of archive
entries from the command line list of extract selection pat
terns. unzip's philosophy is ``you get what you ask for'' (this
is also responsible for the L/ U change; see the relevant
options below). Because some file systems are fully case sensi
tive (notably those under the Unix operating system) and because
both ZIP archives and unzip itself are portable across plat
forms, unzip's default behavior is to match both wildcard and
literal filenames case sensitively. That is, specifying ``make
file'' on the command line will only match ``makefile'' in the
archive, not ``Makefile'' or ``MAKEFILE'' (and similarly for
wildcard specifications). Since this does not correspond to the
behavior of many other operating/file systems (for example, OS/2
HPFS, which preserves mixed case but is not sensitive to it),
the C option may be used to force all filename matches to be
case insensitive. In the example above, all three files would
then match ``makefile'' (or ``make*'', or similar). The C
option affects file specs in both the normal file list and the
excluded file list (xlist).

Please note that the C option does neither affect the search
for the zipfile(s) nor the matching of archive entries to exist
ing files on the extraction path. On a case sensitive file sys
tem, unzip will never try to overwrite a file ``FOO'' when
extracting an entry ``foo''!

D skip restoration of timestamps for extracted items. Normally,
unzip tries to restore all meta information for extracted items
that are supplied in the Zip archive (and do not require privi
leges or impose a security risk). By specifying D, unzip is
told to suppress restoration of timestamps for directories
explicitly created from Zip archive entries. This option only
applies to ports that support setting timestamps for directories
(currently ATheOS, BeOS, MacOS, OS/2, Unix, VMS, Win32, for
other unzip ports, D has no effect). The duplicated option DD
forces suppression of timestamp restoration for all extracted
entries (files and directories). This option results in setting
the timestamps for all extracted entries to the current time.

On VMS, the default setting for this option is D for consis
tency with the behaviour of BACKUP: file timestamps are
restored, timestamps of extracted directories are left at the
current time. To enable restoration of directory timestamps,
the negated option D should be specified. On VMS, the option
D disables timestamp restoration for all extracted Zip archive
items. (Here, a single D on the command line combines with the
default D to do what an explicit DD does on other systems.)

E [MacOS only] display contents of MacOS extra field during
restore operation.

F [Acorn only] suppress removal of NFS filetype extension from
stored filenames.

F [non Acorn systems supporting long filenames with embedded com
mas, and only if compiled with ACORN_FTYPE_NFS defined] trans
late filetype information from ACORN RISC OS extra field blocks
into a NFS filetype extension and append it to the names of the
extracted files. (When the stored filename appears to already
have an appended NFS filetype extension, it is replaced by the
info from the extra field.)

i [MacOS only] ignore filenames stored in MacOS extra fields.
Instead, the most compatible filename stored in the generic part
of the entry's header is used.

j junk paths. The archive's directory structure is not recreated;
all files are deposited in the extraction directory (by default,
the current one).

J [BeOS only] junk file attributes. The file's BeOS file
attributes are not restored, just the file's data.

J [MacOS only] ignore MacOS extra fields. All Macintosh specific
info is skipped. Data fork and resource fork are restored as
separate files.

K [AtheOS, BeOS, Unix only] retain SUID/SGID/Tacky file
attributes. Without this flag, these attribute bits are cleared
for security reasons.

L convert to lowercase any filename originating on an uppercase
only operating system or file system. (This was unzip's default
behavior in releases prior to 5.11; the new default behavior is
identical to the old behavior with the U option, which is now
obsolete and will be removed in a future release.) Depending on
the archiver, files archived under single case file systems
(VMS, old MS DOS FAT, etc.) may be stored as all uppercase
names; this can be ugly or inconvenient when extracting to a
case preserving file system such as OS/2 HPFS or a case sensi
tive one such as under Unix. By default unzip lists and
extracts such filenames exactly as they're stored (excepting
truncation, conversion of unsupported characters, etc.); this
option causes the names of all files from certain systems to be
converted to lowercase. The LL option forces conversion of
every filename to lowercase, regardless of the originating file

M pipe all output through an internal pager similar to the Unix
more(1) command. At the end of a screenful of output, unzip
pauses with a `` More '' prompt; the next screenful may be
viewed by pressing the Enter (Return) key or the space bar.
unzip can be terminated by pressing the ``q'' key and, on some
systems, the Enter/Return key. Unlike Unix more(1), there is no
forward searching or editing capability. Also, unzip doesn't
notice if long lines wrap at the edge of the screen, effectively
resulting in the printing of two or more lines and the likeli
hood that some text will scroll off the top of the screen before
being viewed. On some systems the number of available lines on
the screen is not detected, in which case unzip assumes the
height is 24 lines.

n never overwrite existing files. If a file already exists, skip
the extraction of that file without prompting. By default unzip
queries before extracting any file that already exists; the user
may choose to overwrite only the current file, overwrite all
files, skip extraction of the current file, skip extraction of
all existing files, or rename the current file.

N [Amiga] extract file comments as Amiga filenotes. File comments
are created with the c option of zip(1), or with the N option
of the Amiga port of zip(1), which stores filenotes as comments.

o overwrite existing files without prompting. This is a dangerous
option, so use it with care. (It is often used with f, how
ever, and is the only way to overwrite directory EAs under

P password
use password to decrypt encrypted zipfile entries (if any).
THIS IS INSECURE! Many multi user operating systems provide
ways for any user to see the current command line of any other
user; even on stand alone systems there is always the threat of
over the shoulder peeking. Storing the plaintext password as
part of a command line in an automated script is even worse.
Whenever possible, use the non echoing, interactive prompt to
enter passwords. (And where security is truly important, use
strong encryption such as Pretty Good Privacy instead of the
relatively weak encryption provided by standard zipfile utili

q perform operations quietly ( qq = even quieter). Ordinarily
unzip prints the names of the files it's extracting or testing,
the extraction methods, any file or zipfile comments that 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 awkward
ness in some cases.

S [VMS] convert text files ( a, aa) into Stream_LF record format,
instead of the text file default, variable length record format.
(Stream_LF is the default record format of VMS unzip. It is
applied unless conversion ( a, aa and/or b, bb) is requested
or a VMS specific entry is processed.)

U [UNICODE_SUPPORT only] modify or disable UTF 8 handling. When
UNICODE_SUPPORT is available, the option U forces unzip to
escape all non ASCII characters from UTF 8 coded filenames as

Related Topics

Apt Get Commands