Archives and compression

Command unzip

Unpack zip-archive

Linux · Bash examples · commands run on the selected server

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.zip

Square 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

-l
List ZIP archive contents.
-t
Check the integrity of files.
-d DIRECTORY
Select an unpacking location; -n prevents replacement of existing files.

Usage examples

List archive contents

unzip -l ./project.zip

Archive names and sizes are listed without extraction.

Check integrity

unzip -t ./project.zip

Compressed entries are tested for consistency without writing their extracted files.

Unpack without overwriting

unzip -n ./project.zip -d ./unpacked

Extraction 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.