Archives

Linux unzip command

List or extract ZIP contents. Inspect untrusted archives before extraction.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

unzip [OPTION]... ARCHIVE.zip [FILE...] [-d DIRECTORY]

Examples

Inspect the list of files in an archive.

unzip -l site-backup.zip

Extract without replacing existing files.

unzip -n site-backup.zip -d ./restore

Parameters, options and clauses

Option / clauseDescription
-lList archive contents without extracting.
-tTest archive integrity.
-oOverwrite existing files without prompting.
-nNever overwrite existing files.
-jDiscard directory paths and extract into one directory.
-d DIRExtract files into DIR.
-ZRun zipinfo mode for archive listing options.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory