Zip/Unzip on Linux: Reference and Examples

Last updated:

Zip a single file

$ zip large-file.txt

Unzip a zip file

$ unzip

Zip a directory

$ zip -r large-dir/

Unzip a file into another directory

By default, stuff is extracted into the current directory, which can cause a mess if you archive has many files.

$ unzip -d someDirectory

Add a password

You'll be prompted for a password to protect your archive (you won't see it typed to the terminal however)

$ zip -e large-file.txt

You can use more than one modifier at the same time (encrypt and zip directory)

$ zip -re large-dir/

Dialogue & Discussion