Skip to content
Latchkey

unzip Command Reference for CI Scripts

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.

Common flags/usage

  • -o: overwrite existing files without prompting
  • -n: never overwrite existing files
  • -d DIR: extract into a target directory
  • -q: quiet
  • -l / -t: list contents / test archive integrity

Example

shell
curl -fsSL -o tool.zip "https://example.com/${TOOL}.zip"
unzip -q -o tool.zip -d "${HOME}/bin"

In CI

Without -o, unzip stops at "replace X? [y]es, [n]o" and the job hangs until timeout; always pass -o or -n in scripts. "End-of-central-directory signature not found" means the file is truncated or not a real zip, usually a failed download.

Key takeaways

  • Always pass -o or -n so unzip never blocks on an overwrite prompt.
  • Use -d to extract into a specific directory instead of the current one.
  • An "end-of-central-directory" error means a truncated or non-zip file.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →