[Shell command] Create a password-protected ZIP file with zip

Created on November 28, 2026

You can use the -P or --password option of the zip command to create a ZIP archive that requires a password to extract. This example compresses dummy.txt into dummy.zip using mypassword as the extraction password.

zip -P mypassword dummy.zip dummy.txt
Shell command