unzip: Usage, Options & Common CI Errors
unzip extracts files from a .zip archive into the current or a chosen directory.
unzip is the counterpart to zip. In CI its biggest trap is the interactive overwrite prompt, which silently hangs a non-interactive job until it times out.
What it does
unzip lists, tests, and extracts files from ZIP archives. By default it prompts before overwriting existing files, which is a problem in non-interactive pipelines.
Common usage
unzip archive.zip
unzip -o archive.zip # overwrite without prompting
unzip -d /target archive.zip # extract into a directory
unzip -l archive.zip # list contents
unzip -q -o archive.zip # quiet + overwriteOptions
| Flag | What it does |
|---|---|
| -o | Overwrite existing files without prompting |
| -n | Never overwrite existing files |
| -d <dir> | Extract into a target directory |
| -q | Quiet |
| -l / -t | List / test archive integrity |
Common errors in CI
Without -o, unzip stops at "replace X? [y]es, [n]o, [A]ll" and the job hangs until timeout - always pass -o or -n in scripts. "End-of-central-directory signature not found … not a zipfile, or … part of a multi-part archive" means the file is truncated or not a real zip (often a failed/partial download). Exit 9 = no matching files; exit 1 = a warning (e.g. one file failed) but extraction otherwise succeeded.