unzip
open a zip archiveunzip extracts a zip archive into the current directory, recreating the directories stored inside it. It can also list or test an archive without extracting anything, which is the sensible first step.
List first with -l, then extract with -d into a directory of your choosing.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
Each entry’s original size, date and stored path. Every path begins with site/, so extraction will create one tidy directory.
6032 bytes across three entries. Worth a glance on a large download, to know the space it needs.
The directory is created if it does not exist. Without -d, files land wherever you are standing.
Directories are created, compressed files are inflated back to full size.
Switches
A switch changes how the command behaves. These are the ones used day to day; man unzip lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-l- List the contents without extracting.
-d DIR- Extract into this directory.
-o- Overwrite existing files without asking.
-n- Never overwrite an existing file.
-t- Test the archive for errors.
-q- Quiet: do not list each file.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
unzip -t backup.zipTests every file in the archive for corruption.
unzip site.zip "site/css/*"Extracts only the entries matching a pattern.
unzip -o update.zipOverwrites existing files without asking.
unzip -q big.zip -d outExtracts quietly, without listing every file.
In cybersecurity
An archive from elsewhere is a set of instructions to write files on your machine.
An archive with no top directory scatters its files among yours. -l shows this before it happens; -d into an empty directory contains it.
A few kilobytes can expand into terabytes. The listing shows the unpacked size; be wary of any archive whose total is absurd for its file size.
Entries named with ../ try to write outside the destination. Current unzip refuses them, but tools built on other libraries may not.