Extract files from a zip archive


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

Runs on:

QNX Neutrino, Microsoft Windows


x86 only


The options include:

-d exdir
Extract files into exdir.
Freshen the existing files.
("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.
Extract files to pipe (stdout).
Update the timestamp for the archive to match the latest timestamp of the archive files.
Test the archive files.
Update existing files and create new ones if needed.
Be verbose or print diagnostic version information.
-x xlist
Exclude the files in the xlist.
ZipInfo mode. If the first option on the command line is -Z, the remaining options are taken as ZipInfo options.
Display the archive comment only.

The modifiers include:

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


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.


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:

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

Exit status:

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