Files
2024-12-01 12:42:18 -08:00

716 B
Executable File

The basic syntax for the zip command is:

zip [options] zipfile files/directories

Common options include:

  • -r: Recursively include files in directories
  • -q: Quiet mode (less output)
  • -v: Verbose mode
  • -u: Update existing entries if newer
  • -9: Maximum compression
  • -0: Store files only, no compression
  • -e: Encrypt the zipfile with a password

Some common examples:

# Create a zip archive of multiple files
zip archive.zip file1.txt file2.txt

# Create a zip archive of a directory and all its contents
zip -r archive.zip directory/

# Create an encrypted zip file
zip -e secure.zip confidential.txt

# Add/update files in an existing zip
zip -u archive.zip newfile.txt