Copied to clipboard

zip

zip is a command-line program that can be used to compress multiple files into a single ZIP file for storage and transportation.

Example

  • Recursively compress a folder and its contents: zip -r archive.zip folder
  • Compress only newer files in the target file: zip -u archive.zip file
  • Display more information during compression: zip -v archive.zip file
  • Do not compress directories during compression: zip -c archive.zip file
  • Compress empty files during compression: zip -z archive.zip file
  • Set the file name suffix for the compressed file, usually '.zip': zip -a archive.zip file
  • Do not save path information during compression: zip -j archive.zip file
  • No compression: zip -0 archive.zip file
  • Fastest compression method: zip -1 archive.zip file
  • Medium compression method: zip -2 archive.zip file
  • Minimal compression rate, also the slowest compression method: zip -3 archive.zip file
  • Display help information: zip --help
  • To compress multiple files, simply add the filenames to be compressed after the command. For example, to compress files 1.txt, 2.txt, and 3.txt into a ZIP file named "archive.zip", use the following command: zip archive.zip 1.txt 2.txt 3.txt