unzip — Extract files from a ZIP archive — the read side of zip across all 5 shells
Equivalents in every shell
unzip archive.zipInfo-ZIP `unzip` — POSIX-portable, ships in nearly every Linux distro, on macOS, and on every BSD. `-d <dir>` extracts to a target directory; `-o` overwrites without prompting; `-l` lists contents without extracting; `-j` strips directory paths (flatten). For non-ASCII filenames (Japanese, Cyrillic), `-O <encoding>` (e.g. `-O CP932`) decodes legacy Windows-encoded ZIPs.
unzip archive.zipSame Info-ZIP binary on Linux. macOS ships its own slightly older `unzip` build by default — for unicode filename support pass `-O UTF-8` (the default on Linux). `brew install unzip` updates to the latest Info-ZIP.
unzip archive.zipSame external. Fish has no built-in archive primitive. To extract multiple ZIPs in a loop: `for z in *.zip; unzip -o $z -d (basename $z .zip); end` — note the `(...)` for command substitution (no `$(...)` in fish).
Expand-Archive -Path archive.zip -DestinationPath ./outNative cmdlet since PowerShell 5.0 (Windows 10 / Server 2016). `-Force` overwrites; `-DestinationPath` defaults to the current directory if omitted. The underlying implementation is `System.IO.Compression.ZipFile.ExtractToDirectory` — fast on the common path, but does NOT preserve Unix file modes or symlinks (those are ZIP-format extensions Info-ZIP supports but `Expand-Archive` ignores).
tar -xf archive.zipWindows 10 1803+ ships `bsdtar` as the system `tar.exe`, which transparently extracts ZIP archives in addition to tarballs. Older Windows: no native unzipper — use `powershell -c Expand-Archive` or call the COM-side `Shell.Application` (`CopyHere` from the zip namespace).
Worked examples
Extract a ZIP to a specific directory
unzip archive.zip -d /tmp/outExpand-Archive -Path archive.zip -DestinationPath /tmp/out -Forcetar -xf archive.zip -C C:\tmp\outList archive contents without extracting
unzip -l archive.zip[IO.Compression.ZipFile]::OpenRead((Resolve-Path archive.zip)).Entries | Select FullName, Lengthtar -tf archive.zipExtract just one file from inside a ZIP
unzip archive.zip path/inside/file.txt -d ./out[IO.Compression.ZipFile]::OpenRead((Resolve-Path archive.zip)).GetEntry("path/inside/file.txt").Open()tar -xf archive.zip path/inside/file.txtGotchas
- `Expand-Archive` does NOT preserve Unix file permissions or symbolic links stored in the ZIP. A ZIP created on Linux with `zip -y` (preserve symlinks) will, after `Expand-Archive`, contain regular files containing the symlink target as text. Use Info-ZIP `unzip` (e.g. via WSL or `choco install unzip`) when symlinks matter.
- `tar -xf archive.zip` works in Windows 10 1803+ ONLY because the bundled bsdtar speaks the ZIP format. Older Windows ships GNU tar (no ZIP support) or no tar at all. Check `tar --version`: bsdtar shows "bsdtar" in the banner.
- ZIP filename encoding is historically unspecified — pre-2007 ZIPs from Asian-locale Windows machines often used CP932 / CP949 / GB18030 instead of UTF-8. `unzip -O CP932 archive.zip` decodes them correctly. `Expand-Archive` has no encoding override and produces mojibake on these archives.
- Path-traversal CVEs: malicious ZIPs may contain entries with `../../` paths or absolute paths that escape the extraction root ("zip slip"). Info-ZIP `unzip` (since 6.0) and `Expand-Archive` both reject these, but rolling your own with `[IO.Compression.ZipFile]::ExtractToDirectory` in PowerShell 4 or below was vulnerable — verify the target path stays inside the destination before extracting if you call the .NET API directly.
- On macOS, double-clicking a ZIP in Finder runs Archive Utility, which is NOT `unzip` — it stores files' resource forks as `__MACOSX/._*` companion files. Re-zipping that directory with `zip -r` re-includes the cruft. Pass `-x "__MACOSX/*" -x "*.DS_Store"` when re-packaging.
WSL & PowerShell Core notes
Common tasks using unzip
- Extract a 7z archive
Unpack a `.7z` file — the highest-ratio common archive format, popular on Windows software downloads and big game/asset bundles.
- Extract a zip archive
Unpack a `.zip` file from the command line — the most common archive format on the web, and a frequent source of "how do I unzip on Windows without GUI" searches.