unzip password protected zip in unix
unzip -P your-password zipfile.zip
man unzip
-P password
use password to decrypt encrypted zipfile entries (if any). THIS IS INSECURE! Many multi-user operating systems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the-shoulder peeking. Storing the plaintext password as part of a command line in an automated script is even worse. Whenever possible, use the non-echoing, interactive prompt to enter passwords. (And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak encryption provided by standard zipfile utilities.)
In Ubuntu, I've to install 7zip (7z) archive tool using following command:
sudo apt-get install p7zip-full
Then, you can use Ubuntu's default Archive Manager to unzip the password protected zip files
I ran into problem using unzip
saying need PK compat. v5.1 (can do v4.6)
.
Installed p7zip
instead and unzipped using following command:
7z x archive.zip -ppassword
To unzip multiple password protected files, this command WILL NOT WORK
unzip -P PASSWORD *.zip
To make it work, you need to include the *.zip
in quotes because whenever you use a wildcard (*), the shell itself will expand that and pass the results to the program. This is because, unlike most programs in UNIX, unzip cannot take more than one file at a time.
Read more here https://chrisjean.com/unzip-multiple-files-from-linux-command-line/.
Therefore, to unzip multiple protected files, use this
unzip -P PASSWORD '*.zip'