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
zip Command Reference for CI Scriptszip packs files into cross-platform .zip archives in CI. Reference for -r, -j, -q, and -x, plus the missing-b…
tar Command Reference for CI Scriptstar bundles and extracts archives in CI for caches and artifacts. Reference for -c, -x, -z, -C, and the compr…
curl Command Reference for CI Scriptscurl transfers data over HTTP(S) in CI scripts. Reference for -f, -sS, -L, -o, and --retry so downloads fail…
gzip Command Reference for CI Scriptsgzip compresses single files with DEFLATE in CI. Reference for -d, -k, -c, and compression levels, plus the t…