unzip

Extract files from a zip archive

Syntax:

unzip [-Z] [-opts[modifiers]] file[.zip] [list]
      [-x xlist] [-d exdir]

Runs on:

QNX Neutrino, Microsoft Windows

Targets:

x86 only

Options:

The options include:

-d exdir
Extract files into exdir.
-f
Freshen the existing files.
-l
(“el”) List archive files (short format).
-P password
Use the given password to unencrypt the archive entries.

Note: Specifying a plain-text password on the command line or in a script can be a security problem.

-p
Extract files to pipe (stdout).
-T
Update the timestamp for the archive to match the latest timestamp of the archive files.
-t
Test the archive files.
-u
Update existing files and create new ones if needed.
-v
Be verbose or print diagnostic version information.
-x xlist
Exclude the files in the xlist.
-Z
ZipInfo mode. If the first option on the command line is -Z, the remaining options are taken as ZipInfo options.
-z
Display the archive comment only.

The modifiers include:

-a
Automatically convert any text files.
-aa
Extract all files as text files.
-C
Match files case-insensitively.
-j
Junk the path to the file; do not make directories.
-K
Keep setuid/setgid/tacky permissions.
-L
Convert some names to lowercase.
-M
Pipe all output through an internal pager that's similar to the more command.
-n
Never overwrite existing files.
-o
Overwrite existing files without prompting.
-q
Perform operations quietly. Use -qq to make them quieter.
-U
Use escapes for all non-ASCII Unicode.
-UU
Ignore any Unicode fields.
-V
Retain VMS file version numbers.
-X
Restore user and group (UID/GID) information.

Description:

The unzip utility lists, tests, or extracts files from a ZIP archive. 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, creates ZIP archives; both programs are compatible with archives created by PKZIP and PKUNZIP.

Examples:

Extract all members of the archive letters.zip into the current directory and subdirectories below it, creating any subdirectories as necessary, using unzip:

unzip letters

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

unzip -j letters

Test letters.zip. Use the following command to print only a summary message indicating whether the archive is all right or not:

unzip -tq letters

Test all zipfiles in the current directory, and print only the summaries:

unzip -tq \*.zip

Extract all members of letters.zip whose names end in .tex, to standard output, auto-convert to the local end-of-line convention, and pipe the output into more:

unzip -ca letters \*.tex | more

Extract the binary file paper1.dvi to standard output, and pipe it to a printing program:

unzip -p articles paper1.dvi | dvips

Extract newer versions of the files already in the current directory and create any files not already there:

unzip -uo sources

Display a diagnostic screen showing which unzip and zipinfo options are stored in environment variables:

unzip -v

See whether decryption support was compiled with the files:

unzip -v

See the compiler that unzip used:

unzip -v

Environment variables:

UNZIP
A set of default options for unzip. For example:
export UNZIP="-qq"

Exit status:

0
The operation succeeded.
2
A generic error in the zipfile format was detected, but processing may have completed successfully anyway; a warning was generated in the process.
3
A severe error in the zipfile format was detected; processing probably failed immediately.
4
unzip was unable to allocate memory for one or more buffers during program initialization.
5
unzip was unable to allocate memory or unable to obtain a tty to read the decryption password(s).
6
unzip was unable to allocate memory during decompression to disk.
9
The specified zipfiles were not found.
10
Invalid options were specified on the command line.
11
No matching files were found.
50
The disk is, or was, full during extraction.
51
The end of the ZIP archive was encountered prematurely.
80
The user aborted unzip prematurely with Ctrl-C or a similar command.
81
Testing or extraction of one or more files failed, due to unsupported compression methods or unsupported decryption.
82
No files were found, due to bad decryption password(s). If even one file is successfully processed, however, the exit status is 1.

See also:

freeze, gzip, pax, tar, zip

Backing Up and Recovering Data in the Neutrino User's Guide