15%

Save 15% on All Hosting Services

Test your skills and get Discount on any hosting plan

Use code:

Skills
Get Started
22.10.2024

How to Unzip Files on Any Device: Windows, macOS, Android, iOS, and Linux

Unzipping a file means decompressing an archive — typically a .zip container — to restore its original contents to a usable, readable state. Every major operating system ships with native extraction support, so no third-party software is required for standard .zip archives. For formats like .7z, .rar, .tar.gz, or password-protected archives, dedicated tools provide broader codec support, stronger encryption handling, and batch-processing capabilities.

This guide covers every major platform in technical depth, including command-line methods that most tutorials skip entirely, along with a comparison of the most capable third-party tools, common failure modes, and the scenarios where each approach is the right choice.

Why File Compression and Extraction Still Matter

Compressed archives reduce transfer size, bundle directory trees into a single portable object, and preserve file permissions and metadata when the format supports it. On a VPS Hosting environment, for example, deploying an application often means uploading a .tar.gz or .zip archive and extracting it server-side — making command-line extraction an essential skill, not an optional one.

Understanding the internals also prevents data loss. A .zip file stores each entry with its own local header and CRC-32 checksum. A corrupted central directory at the end of the archive can make the file appear broken to GUI tools, yet unzip -FF or 7-Zip's repair mode can often recover most entries.

How to Unzip Files on Windows

Windows 10 and Windows 11 include a native extraction engine integrated directly into File Explorer. No third-party installation is required for standard .zip archives.

Using File Explorer (GUI Method)

Step 1 — Locate the archive. Open File Explorer and navigate to the folder containing your .zip file. Zip archives display a folder icon overlaid with a zipper graphic.

Step 2 — Open the context menu. Right-click the .zip file. On Windows 11, select Show more options first if the classic context menu is not immediately visible.

Step 3 — Extract All. Click Extract All. A dialog prompts you for a destination path. The default is a subfolder named after the archive, placed in the same directory.

Step 4 — Choose destination and extract. Click Browse to select a different path, then click Extract. File Explorer displays a progress bar for large archives.

Step 5 — Verify the output. The destination folder opens automatically upon completion. Confirm that the file count and directory structure match your expectations before deleting the original archive.

Using PowerShell (Command-Line Method)

For scripted deployments, automated pipelines, or headless Windows Server environments, PowerShell's Expand-Archive cmdlet is the correct tool:

# Extract to a specific destination folder
Expand-Archive -Path "C:Downloadsarchive.zip" -DestinationPath "C:Projectsmyapp"

# Overwrite existing files without prompting
Expand-Archive -Path "C:Downloadsarchive.zip" -DestinationPath "C:Projectsmyapp" -Force

The -Force flag is critical in deployment scripts — without it, the cmdlet throws a terminating error if any destination file already exists.

Using the Legacy tar Command (Windows 10 1803+)

Windows 10 build 1803 and later ship with BSD tar, which handles .zip natively alongside .tar, .tar.gz, and .tar.bz2:

tar -xf archive.zip -C C:Projectsmyapp

The -C flag specifies the destination directory. This is particularly useful in batch files and CI/CD pipelines where PowerShell execution policy restrictions might apply.

Critical Windows Pitfall: The "Blocked" File Attribute

Files downloaded from the internet acquire an Alternate Data Stream tag (Zone.Identifier) that Windows marks as potentially unsafe. Extracting a blocked archive can silently strip or quarantine contents. Before extracting, right-click the .zip, select Properties, and check Unblock at the bottom of the General tab, or use PowerShell:

Unblock-File -Path "C:Downloadsarchive.zip"

Skipping this step is one of the most common reasons extracted executables or DLLs fail to run correctly on Windows.

How to Unzip Files on macOS

macOS includes Archive Utility, which handles .zip extraction transparently through a double-click. For .tar.gz, .tar.bz2, and .7z, the Terminal provides full control.

Using Archive Utility (GUI Method)

Step 1 — Locate the archive. Open Finder and navigate to the .zip file. It appears as a compressed folder icon.

Step 2 — Double-click to extract. Archive Utility launches silently and extracts the contents into a new folder in the same directory, named identically to the archive minus the .zip extension.

Step 3 — Verify output. The new folder appears immediately. Archive Utility does not prompt for a destination — if you need to extract to a specific path, use the Terminal method below.

Using the Terminal (Command-Line Method)

# Extract a .zip archive to the current directory
unzip archive.zip

# Extract to a specific destination directory
unzip archive.zip -d /Users/yourname/Projects/myapp

# List archive contents without extracting
unzip -l archive.zip

# Extract a password-protected zip
unzip -P secretpassword archive.zip -d /tmp/output

For .tar.gz archives — the standard format for Linux software distributions and server backups:

# Extract .tar.gz to current directory
tar -xzf archive.tar.gz

# Extract .tar.gz to a specific directory
tar -xzf archive.tar.gz -C /usr/local/myapp

# Extract .tar.bz2
tar -xjf archive.tar.bz2 -C /usr/local/myapp

# Extract .tar.xz (highest compression ratio)
tar -xJf archive.tar.xz -C /usr/local/myapp

macOS-Specific Pitfall: Gatekeeper and Quarantine

macOS applies the com.apple.quarantine extended attribute to downloaded archives. Even after extraction, the contents inherit this attribute. If extracted binaries refuse to launch, clear the quarantine flag:

xattr -rd com.apple.quarantine /path/to/extracted/folder

This is a frequent source of confusion when deploying downloaded software packages on macOS.

How to Unzip Files on Linux

Linux is where command-line extraction is not optional — it is the standard workflow, especially on headless servers. If you manage a Dedicated Server or a cloud VPS, these commands are daily operations.

Installing Extraction Utilities

Most Linux distributions include unzip and tar by default. If missing:

# Debian / Ubuntu
sudo apt update && sudo apt install unzip p7zip-full

# RHEL / CentOS / AlmaLinux / Rocky Linux
sudo dnf install unzip p7zip p7zip-plugins

# Arch Linux
sudo pacman -S unzip p7zip

Extracting ZIP Archives

# Basic extraction to current directory
unzip archive.zip

# Extract to a specific directory (creates it if absent)
unzip archive.zip -d /var/www/html/mysite

# Extract a single file from the archive
unzip archive.zip config/settings.php -d /var/www/html/mysite

# Suppress output (useful in scripts)
unzip -q archive.zip -d /var/www/html/mysite

# Test archive integrity without extracting
unzip -t archive.zip

Extracting TAR Archives

# .tar.gz (gzip-compressed)
tar -xzf backup.tar.gz -C /var/backups/restored/

# .tar.bz2 (bzip2-compressed — slower but better ratio)
tar -xjf backup.tar.bz2 -C /var/backups/restored/

# .tar.xz (xz-compressed — best ratio, slowest)
tar -xJf backup.tar.xz -C /var/backups/restored/

# Verbose output — lists each file as it extracts
tar -xzvf backup.tar.gz -C /var/backups/restored/

# Extract a single file or directory from a tar archive
tar -xzf backup.tar.gz -C /tmp/ ./etc/nginx/nginx.conf

Preserving File Permissions and Ownership

This is a critical server administration detail that GUI tools and basic tutorials consistently omit. When extracting application archives on a Linux server, ownership and permissions must be preserved:

# Preserve permissions (default with tar)
tar -xzpf archive.tar.gz -C /var/www/html/

# Extract and set ownership to www-data (web server user)
tar -xzf archive.tar.gz -C /var/www/html/ && chown -R www-data:www-data /var/www/html/myapp

The -p flag in tar explicitly preserves permissions. Without correct ownership, web applications will fail with permission-denied errors even though the files exist.

How to Unzip Files on Android

Android does not include a native archive manager in its stock file application on all OEM variants. A dedicated app is typically required.

Step 1 — Install a file manager with archive support. Recommended options:

  • Files by Google — clean, minimal, handles .zip natively
  • ZArchiver — supports .zip, .7z, .rar, .tar.gz, .tar.bz2, and encrypted archives
  • RAR by RARLAB — official app from the WinRAR developers, handles .rar and .zip

Step 2 — Navigate to the archive. Open the app and browse to the folder containing the .zip or other archive file.

Step 3 — Initiate extraction. Long-press or tap the archive. Select Extract or Extract here. ZArchiver presents a destination picker; Files by Google extracts to the same directory by default.

Step 4 — Verify the output. Navigate to the destination folder and confirm the contents are accessible.

Android-specific note: If the archive was downloaded via a browser, it typically lands in /storage/emulated/0/Download/. Some OEM file managers restrict access to certain paths — if extraction fails silently, switch to ZArchiver, which requests broader storage permissions.

How to Unzip Files on iPhone and iPad

iOS 13 and later include native .zip extraction in the Files app. No third-party app is required for standard archives.

Step 1 — Open the Files app. Locate the .zip file. Common locations include Downloads, iCloud Drive, or On My iPhone.

Step 2 — Tap the archive once. The Files app automatically extracts the contents into a new folder in the same location. There is no destination picker — extraction always occurs in place.

Step 3 — Access the extracted folder. A folder with the same name as the archive (minus .zip) appears immediately.

For non-ZIP formats on iOS: The Files app does not handle .rar, .7z, or .tar.gz. Use iZip (free, supports .zip, .rar, .7z, .tar) or Archiver 4 (paid, excellent format support and iCloud integration).

Third-Party Archive Tools: Feature Comparison

When native tools are insufficient — handling .rar archives, AES-256 encrypted zips, multi-volume archives, or solid archives — third-party tools become necessary. The table below compares the most widely used options across the criteria that matter in professional environments.

ToolPlatformLicenseFormats SupportedEncryptionGUICLINotable Strength
7-ZipWindows, LinuxFree / Open SourceZIP, 7Z, TAR, GZ, BZ2, XZ, RAR (extract), ISO, WIMAES-256YesYes (7z)Best compression ratio; fully open source
WinRARWindows, macOSShareware (trial)RAR, ZIP, TAR, GZ, BZ2, 7Z, ISO, CABAES-256YesYes (rar)Best RAR creation and repair support
The UnarchivermacOSFreeZIP, RAR, 7Z, TAR, GZ, BZ2, LZH, ISO, CARLimitedYesNoWidest macOS format support; App Store
ZArchiverAndroidFree (Pro available)ZIP, 7Z, RAR, TAR, GZ, BZ2, XZ, ZSTAES-256YesNoBest Android archive manager
iZipiOSFree (Pro available)ZIP, RAR, 7Z, TAR, GZAES-256YesNoDeep Files app and iCloud integration
p7zipLinuxFree / Open SourceZIP, 7Z, TAR, GZ, BZ2, XZ, RAR (extract)AES-256NoYes (7z)Server-side scripting; identical to 7-Zip
PeaZipWindows, LinuxFree / Open Source200+ formatsAES-256YesYesWidest format support; portable version

Handling Password-Protected and Encrypted Archives

Password-protected archives are common in secure file transfers, software distribution, and backup workflows. Each tool handles them slightly differently.

On Windows with 7-Zip:

# 7-Zip command-line extraction with password
7z x archive.zip -pYourPassword -o"C:output"

On Linux / macOS with unzip:

unzip -P YourPassword archive.zip -d /output/path

On Linux with 7z (p7zip):

7z x archive.7z -pYourPassword -o/output/path

Important security note: Passing passwords as command-line arguments exposes them in process lists (ps aux) and shell history. In production environments, use a password file or an environment variable:

# Read password from a file (7-Zip supports this via stdin piping)
7z x archive.7z -p"$(cat /etc/archive-password)" -o/output/path

Clear your shell history afterward with history -c or configure HISTCONTROL=ignorespace and prefix the command with a space.

Extracting Archives on a Remote Server

When managing web applications on a VPS with cPanel or a bare Linux VPS, the most efficient deployment workflow is to upload the archive and extract it server-side rather than transferring thousands of individual files.

# Upload archive via SCP
scp myapp.tar.gz user@yourserver.com:/var/www/html/

# SSH into the server and extract
ssh user@yourserver.com
cd /var/www/html/
tar -xzf myapp.tar.gz
rm myapp.tar.gz  # Remove archive after successful extraction

For large archives, run the extraction inside a screen or tmux session to prevent interruption if the SSH connection drops:

screen -S deploy
tar -xzf largebackup.tar.gz -C /var/www/html/
# Detach with Ctrl+A, D — reattach with: screen -r deploy

This pattern is standard practice when restoring backups or deploying application bundles on Dedicated Servers.

Common Extraction Errors and How to Fix Them

"End-of-central-directory signature not found" — The archive is truncated or corrupted. This happens with interrupted downloads. Re-download the file and verify its MD5/SHA256 checksum if the source provides one. Attempt recovery with:

zip -FF corrupted.zip --out recovered.zip
unzip recovered.zip -d /output

"Cannot create file: filename too long" — Windows has a 260-character MAX_PATH limit. Enable long path support in Group Policy (Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths) or use 7-Zip, which bypasses this limitation.

"Permission denied" during extraction on Linux — The destination directory is owned by a different user or has restrictive permissions. Use sudo for the extraction command or adjust ownership first:

sudo chown -R $USER:$USER /destination/path
unzip archive.zip -d /destination/path

"Unsupported compression method" — The archive uses a compression algorithm the tool does not support (e.g., Zstandard in newer ZIP implementations, or LZMA in .zip files created by 7-Zip). Install 7-Zip or p7zip, which support the broadest algorithm set.

Files extracted but appear empty or zero-byte — Often caused by extracting a .zip that contains only a directory structure with no actual file data, or by a macOS Archive Utility quirk with certain .zip files created on Linux. Use unzip -l archive.zip to inspect contents before extracting.

Decision Matrix: Choosing the Right Extraction Method

ScenarioRecommended Method
Standard .zip on Windows desktopFile Explorer > Extract All
Scripted deployment on Windows ServerPowerShell Expand-Archive
Standard .zip on macOS desktopDouble-click (Archive Utility)
.tar.gz / .tar.bz2 on macOS or LinuxTerminal tar -xzf / tar -xjf
Server-side extraction on Linux VPSunzip or tar via SSH
.rar archive on any platform7-Zip (Windows/Linux) or The Unarchiver (macOS)
Password-protected archive7-Zip CLI with -p flag
Corrupted archive recoveryzip -FF then unzip, or 7-Zip repair
Mobile device (Android)ZArchiver
Mobile device (iOS)Files app (.zip) or iZip (other formats)
Multi-volume archive (.zip.001, .part1.rar)7-Zip or WinRAR

Technical Key-Takeaway Checklist

  • Always verify archive integrity with unzip -t or 7z t before extracting to production directories.
  • On Linux servers, use tar -xzpf (note the -p flag) to preserve file permissions when extracting application bundles.
  • Unblock downloaded .zip files on Windows before extraction to avoid silent file quarantine.
  • Remove the macOS quarantine attribute from extracted binaries with xattr -rd com.apple.quarantine.
  • Never pass archive passwords as plain CLI arguments in shared or logged environments — use a secrets file or environment variable.
  • For server deployments, extract inside a screen or tmux session to survive SSH disconnections.
  • Use 7-Zip or p7zip as your universal fallback — it handles more formats and edge cases than any native tool on any platform.
  • After extracting to a web server directory, always verify ownership (ls -la) and set it to the web server user (www-data, nginx, or apache) before testing the application.

FAQ

Does Windows 11 natively support .7z and .rar extraction?

No. Windows 11's built-in extraction engine handles only .zip, .cab, and .tar (via the tar command). For .7z, .rar, and other formats, you must install 7-Zip or WinRAR.

What is the difference between .zip and .tar.gz?

A .zip archive compresses each file independently and stores them with individual headers, making random access fast but reducing overall compression efficiency. A .tar.gz first bundles all files into a single uncompressed .tar stream, then applies gzip compression to the entire stream — achieving better ratios but requiring full sequential decompression to access any single file.

Can I extract a .zip file directly on a Linux server without downloading it locally first?

Yes. Use wget or curl to download the archive directly to the server, then extract in place. For publicly accessible archives, you can also pipe a URL through curl directly into bsdtar: curl -L https://example.com/archive.zip | bsdtar -xf- -C /destination/.

Why do extracted files sometimes have wrong permissions on a Linux server?

The .zip format stores UNIX permissions only if the archive was created on a UNIX-like system with a compatible tool. Archives created on Windows typically store no permission metadata, so unzip assigns default permissions based on the current umask. Use chmod and chown explicitly after extraction to set the correct permissions for your web server or application user.

Is it safe to extract archives received by email directly on a server?

No. Always inspect the archive contents first with unzip -l or 7z l before extracting. Malicious archives can contain path traversal sequences (e.g., ../../etc/cron.d/backdoor) that write files outside the intended destination. Use unzip -d /safe/sandbox/path and verify the output before moving files to production. Consider scanning with ClamAV on servers that handle user-uploaded archives.

15%

Save 15% on All Hosting Services

Test your skills and get Discount on any hosting plan

Use code:

Skills
Get Started