When to use unzip
Use unzip to inspect and extract ZIP archives while controlling destination collisions. Review entries and integrity first, and do not extract an unfamiliar archive directly into a production directory.
Syntax
unzip [PARAMETERS] ARCHIVE.zipSquare brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
List archive contents
unzip -l ./project.zipArchive names and sizes are listed without extraction.
Check integrity
unzip -t ./project.zipCompressed entries are tested for consistency without writing their extracted files.
Unpack without overwriting
unzip -n ./project.zip -d ./unpackedExtraction targets a selected directory and does not overwrite existing files.
Notes and limitations
- Unpack the untrusted archive into a separate directory and check the paths.
- Support for name encodings and modern encryption methods depends on build unzip.
Common questions and troubleshooting
Does the no-overwrite option create a clean deployment?
No. Old files can remain, producing a mixed tree. Extract into a fresh directory and switch deployments deliberately.
Can a small ZIP expand into a very large directory?
Yes. Compressed size does not bound extracted size. Check available space and use resource limits for unfamiliar archives.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man unzip.