unzip (Extract Compressed Files)
The unzip command is used to list, test, and extract compressed files in a ZIP archive. It is the most common tool for handling cross-platform compressed data in a Linux environment.
1. Basic Usage
unzip archive.zip
2. Key Options
| Option | Name | Description |
|---|---|---|
-d [path] |
directory | Extracts files into the specified directory. |
-l |
list | Lists archive contents without extracting. |
-t |
test | Tests the integrity of the zip file. |
-o |
overwrite | Overwrites existing files without prompting. |
-v |
verbose | Lists detailed information about the archive. |
3. Practical Examples
① Extracting to a specific location
unzip release.zip -d /var/www/html/
② Checking file structure before extraction
unzip -l backup.zip
③ Overwriting existing files during extraction
Useful for automated scripts or deployments.
unzip -o update.zip
4. [Tip] Standardizing Archives
While unzip is great for compatibility, native Linux systems often prefer tar.gz for better preservation of file permissions (rwx). Use zip mainly for sharing files with non-Linux users.