Automating backup jobs, deploying web servers, or managing remote Linux VPS instances often requires unzipping files without a graphical desktop interface. Here is the ultimate command cheat sheet for Windows PowerShell, Command Prompt, Linux Terminal, and macOS.
📋 Table of Contents
1. Windows PowerShell (Expand-Archive & Tar)
PowerShell provides built-in cmdlets for handling ZIP archives:
Expand-Archive -Path "C:Datafiles.zip" -DestinationPath "C:DataExtracted"
Or using the native tar command in Windows 10 & 11:
tar -xf files.zip -C ./output_folder/
2. Linux Terminal (unzip & 7z)
On Ubuntu, Debian, CentOS, or RHEL:
# Extract archive to current folder
unzip archive.zip
# Extract to a specific directory
unzip archive.zip -d /var/www/html/
# View files without extracting
unzip -l archive.zip
3. macOS Terminal (ditto & unzip)
On macOS, ditto is the native BSD tool that preserves extended file attributes and resource forks:
ditto -xk archive.zip ./destination_directory/
Summary CLI Cheat Sheet
| Operating System | Quick Unzip Command | List Contents Command |
|---|---|---|
| Windows (PowerShell) | Expand-Archive file.zip ./out |
tar -tf file.zip |
| Windows (CMD) | tar -xf file.zip |
tar -tf file.zip |
| Linux (Bash) | unzip file.zip -d ./out |
unzip -l file.zip |
| macOS (zsh) | ditto -xk file.zip ./out |
zipinfo file.zip |
Prefer a Visual 1-Click Tool?
No terminal commands needed. Turn any ZIP archive into a polished PDF in your browser.
Frequently Asked Questions
Run: Expand-Archive -Path archive.zip -DestinationPath .output -Force
Yes! Windows 10 (version 1803+) and Windows 11 include native bsdtar. You can run: tar -xf archive.zip
Use the command: unzip -l archive.zip (or zipinfo archive.zip)
Run: unzip archive.zip 'path/to/specific_file.txt' -d /destination/
Yes, you can easily drag the resulting folder into Zip To PDF in your browser to instantly generate a unified PDF document.