What does zip do?

package and compress files into a .zip archive.

▸ Explain your own zip command →

zip examples, explained

$ zip -r archive.zip src -x '*.log'

  • zippackage and compress files into a .zip archive
  • -rrecurse into directories
  • archive.zipan argument passed to the command
  • srcan argument passed to the command
  • -xexclude files matching the given pattern
  • *.logvalue for -x

$ zip -9 -j out.zip a.txt b.txt

  • zippackage and compress files into a .zip archive
  • -9compress better (slowest)
  • -jjunk paths — store just the file names, not directories
  • out.zipan argument passed to the command
  • a.txtan argument passed to the command
  • b.txtan argument passed to the command

zip flags & options

-0store only — no compression
-9compress better (slowest)
-rrecurse into directories
-qquiet — suppress normal output
-vverbose output (or print version when used alone)
-eencrypt the archive, prompting for a password
-mmove files into the zip — delete the originals after adding
-jjunk paths — store just the file names, not directories
-uupdate — add new files and replace changed ones
-xexclude files matching the given pattern
-iinclude only files matching the given pattern

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.