commands

unzip — inspect and extract ZIP archives

Info-ZIP lists with -l, tests with -t and extracts by default. -d sets destination; -Z -1 lists member names. Only extract trusted archives into a new private directory. Test mode does not authenticate origin. Example assumes a fresh archive lab fixture with new output names.

Formal Syntax & Structure

linux syntaxlinux
unzip [-q] [-l|-t] ARCHIVE [MEMBER...] [-d DIRECTORY]

Parameters & Attributes

NameTypeDescription
-loptionList members without extracting.
-toptionTest compressed member integrity without extracting.
-doptionTakes an extraction directory; omit for current directory. Use a new private directory.
-qoptionquiet
ARCHIVEoperandZIP file
MEMBERoperandOptional member selection; omit to process all members.

Return Value

exit status and output

Info-ZIP lists with -l, tests with -t and extracts by default. -d sets destination; -Z -1 lists member names. Only extract trusted archives into a new private directory. Test mode does not authenticate origin.

Working Example

Example Snippetlinux
zip -q bundle.zip notes.txtunzip -tq bundle.zip >/dev/null && mkdir out && unzip -q bundle.zip -d out && cmp notes.txt out/notes.txt && printf "restored\n"
Linux Reference