Skip to main content

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

OptionDescription
-lList archive files (short format).
-d exdirExtract files into the specified directory exdir.
-tTest archive files.
-oOverwrite existing files without prompting.
-nNever overwrite existing files.

Real-world Examples

  1. Extract all files from a zip archive:

    unzip archive.zip
  2. Extract files to a specific directory:

    unzip archive.zip -d /path/to/destination/
  3. List the contents of a zip archive:

    unzip -l archive.zip
  4. Test an archive to ensure it is not corrupted:

    unzip -t archive.zip