unzip
The unzip command extracts files from a .zip archive. It can also be used to list the contents of an archive or test it for errors without actually extracting it.
Basic Syntax
unzip [OPTIONS] zipfile [file...] [-x xfile...] [-d exdir]
Common Options
| Option | Description |
|---|---|
-l | List archive files (short format). |
-d exdir | Extract files into the specified directory exdir. |
-t | Test archive files. |
-o | Overwrite existing files without prompting. |
-n | Never overwrite existing files. |
Real-world Examples
-
Extract all files from a zip archive:
unzip archive.zip -
Extract files to a specific directory:
unzip archive.zip -d /path/to/destination/ -
List the contents of a zip archive:
unzip -l archive.zip -
Test an archive to ensure it is not corrupted:
unzip -t archive.zip