Unlock the power of the unzip command in Linux with this comprehensive guide. Learn various extraction techniques, including extracting files to standard output, listing files, updating existing files, excluding specific files, extracting into a specific directory, and much more.
Extract files to standard output, no messages
List files (short format)
Freshen existing files, create none
Test compressed archive data
Update files, create if necessary
Display archive comment only
List verbosely/show version info
Exclude files that follow (in xlist)
unzip foo.zip -x filename_to_exclude
Extract files into a specific directory
unzip foo.zip -d /path/to/directory
Never overwrite existing files
Overwrite files WITHOUT prompting
Junk paths (do not make directories)
Match filenames case-insensitively
Keep setuid/setgid/tacky permissions
Examples
Extract all files except 'joe' from zipfile 'data1.zip'
Send contents of 'foo.zip' via pipe into program 'more'
Quietly replace existing 'ReadMe' if archive file newer
List files inside a zip archive
Extract a specific file from a zip archive
unzip foo.zip filename_to_be_unzipped
Unzip multiple zip files
shopt -s nullglob
for zip_file in *.zip; do
unzip -o "$zip_file"
done
Extract 25 zip archive files at once
find . -maxdepth 1 -name "*.zip" -print0 | xargs -0 -I {} -P 25 unzip "{}"
Set a password for a zip file
zip -P mypassword archive.zip file1.txt file2.jpg
Extract files from a password-protected zip file
unzip -P mypassword archive.zip