$linuxjunkies
>

unzip(1)

Extract files from ZIP archives.

UbuntuDebianFedoraArch

Synopsis

unzip [-acdflLmopqtuvVX] [-n|-o|-j] [-P password] [-d exdir] file.zip [file...]

Description

unzip lists, tests, or extracts files from a ZIP archive. By default it extracts all files to the current directory, preserving paths and permissions. It handles standard ZIP format compression including deflate, store, and other methods.

Without options, unzip extracts silently. Use -l to list contents or -t to test integrity without extracting. Passwords are supported for encrypted archives.

Common options

FlagWhat it does
-lList archive contents (filenames, sizes, dates)
-tTest archive integrity without extracting
-vVerbose: show detailed information during extraction
-qQuiet: suppress all messages except errors
-d exdirExtract into directory exdir instead of current directory
-oOverwrite existing files without prompting
-nNever overwrite existing files; skip them
-P passwordUse password to decrypt encrypted archive
-jJunk paths: discard directory structure, extract to single directory
-aConvert text files to native line endings (LF/CRLF)
-LConvert filenames to lowercase
-pExtract to stdout instead of writing files

Examples

Extract all files from archive.zip to current directory

unzip archive.zip

List all files in archive.zip without extracting

unzip -l archive.zip

Extract archive.zip into /tmp directory

unzip -d /tmp archive.zip

Quietly extract, overwriting existing files without prompting

unzip -q -o archive.zip

Test archive.zip for corruption

unzip -t archive.zip

Extract encrypted archive using password to output directory

unzip -P mypass -d output archive.zip

Extract all files ignoring directory structure into flat/ directory

unzip -j archive.zip -d flat/

Extract only specific files from archive

unzip archive.zip file1.txt file2.txt

Related commands