unzip Linux Command
Extracts files from a ZIP archive.
What does unzip do?
Extracts files from a ZIP archive.
Syntax
unzip archive.zipPractical example
unzip project.zip -d ./extractedQuestions about unzip
How do I extract a zip file?
Use `unzip archive.zip` to extract all files in the current directory. Use `-d /path/` to extract to a specific directory.
How do I extract to a specific directory?
Use `unzip archive.zip -d /destination/` to extract files to the specified directory.
How do I list contents without extracting?
Use `unzip -l archive.zip` to list all files in the zip with their sizes and dates.
How do I extract only specific files?
Use `unzip archive.zip file1.txt file2.txt` to extract only the specified files from the archive.
How do I overwrite files without prompting?
Use `unzip -o archive.zip` to overwrite existing files without asking. Use with caution.
How do I test a zip file for corruption?
Use `unzip -t archive.zip` to test the integrity of the zip file without extracting.
How do I extract a password-protected zip?
Use `unzip -P password archive.zip` or `unzip archive.zip` which will prompt for the password.
How do I see what will be extracted?
Use `unzip -l archive.zip` to see the file list, or `unzip -n archive.zip` to extract without overwriting (dry run).
Related Compression Commands
zipCreates a compressed ZIP archive of files and directories.
xzCompresses files using the xz (LZMA2) algorithm — very high compression ratio.
bunzip2Decompresses a .bz2 file back to its original form.
unxzDecompresses a .xz file back to its original form.
bzip2Compresses files using the bzip2 algorithm (better compression than gzip, slower).
7zHigh-compression archiver supporting many formats (7z, zip, rar, tar, etc.).