zip command
Create .zip archives, and extract them with unzip.
- Archives & compression
- Package zip, unzip
- 7 options · 7 examples
Syntax
zip [options] archive.zip file…unzip [options] archive.zip [-d dir]
Provided by the zip, unzip package. Run man zip for the full manual.
Common options
| Option | What it does |
|---|---|
zip -r | Add directories recursively |
zip -e | Encrypt with a password |
zip -x PATTERN | Exclude files |
unzip -d DIR | Extract into DIR |
unzip -l | List the contents |
unzip -o | Overwrite without asking |
unzip -q | Quiet |
Examples
Zip a directory
zip -r site.zip public_html/Zip with a password
zip -er secret.zip docs/Exclude files
zip -r app.zip app/ -x "*.git*" "node_modules/*"Extract a zip
unzip archive.zipExtract into a directory
unzip archive.zip -d /opt/appList the contents
unzip -l archive.zipExtract and overwrite
unzip -o update.zip
No example matches. Check the options table or search the guides.
zip guides
- How to use zip command in Linux Linux Commands · Updated Apr 2025
- How to Unzip into a Specific folder in Linux Linux Commands · Updated Apr 2025
- How to Unzip (Extract) a GZ File in Linux Linux Commands · Updated Apr 2025
