man.lsPlain-English help for Unix commands

zip Package and compress files into a zip archive

Puts files and folders into a single .zip archive and compresses them. Zip files open on almost every system, including Windows, so it is a good choice for sharing. Use unzip to open one.

Synopsis

zip [OPTION]... archive.zip file ...
zip -r archive.zip folder ...

Common options

Option or formWhat it does
-rInclude folders and everything inside them. Without it, zip adds only the folder entry and none of its contents
-qQuiet: do not print each file as it is added
-jJunk the folder names: store files by name only, without their path
-x patternExclude files that match the pattern. Put it after the file list and quote it
-eEncrypt the contents, asking for a password. This protection is weak
-uUpdate: add files that are new or changed since they were zipped
-dDelete the named entries from an existing zip file
-0 to -9Compression level. -0 stores files uncompressed, -1 is fastest, -9 is smallest. The default is 6

Examples

Zip a few files
zip -q notes.zip notes.txt app.log && unzip -l notes.zip | tail -1
Zip a whole folder
zip -rq docs.zip docs && ls docs.zip
docs.zip
Zip a folder but skip some file types
zip -rq site.zip docs photos -x '*.jpg' && unzip -l site.zip
Store files without their folder paths
zip -qj flat.zip docs/readme.md docs/old/report.txt && unzip -l flat.zip
Add a file to an existing zip
zip -q notes.zip notes.txt && zip -q notes.zip data.csv && unzip -l notes.zip
Make a password-protected zip
zip -er private.zip docs

Notes

See also

Last reviewed 2026-10-07.