Skip to content

zip/unzip

Zip is a compression and file packaging utility for Unix, Linux, Windows, and other operating systems.

Syntax

zip [options] archive.zip file1 file2 file3

Options

  • -r: Recursively compress directories.
  • -q: Quiet mode.
  • -v: Verbose mode.
  • -m: Move the files to the zip archive.
  • -d: Delete the files from the zip archive.
  • -u: Update the files in the zip archive.
  • -f: Freshen the files in the zip archive.
  • -t: Test the integrity of the zip archive.
  • -c: Comment the zip archive.
  • -l: List the files in the zip archive.
  • -z: Display the zip archive comment.
  • -x: Exclude the files from the zip archive.
  • -A: Adjust the self-extracting zip archive.
  • -j: Junk the path names.
  • -0: Store the files in the zip archive.
  • -1: Compress the files in the zip archive.
  • -9: Compress the files in the zip archive with the maximum compression.
  • -o: Set the output folder.
  • -P: Set the password.
  • -e: Encrypt the files in the zip archive.
  • -s: Split the zip archive.
  • -y: Store symbolic links as the links.
  • -h: Help.
  • -T: Set the timestamp.
  • -@: Read the file list from the standard input.
  • -i: Include the files in the zip archive.
  • -n: Store the file names in the zip archive.
  • -q: Quiet mode.
  • -v: Verbose mode.
  • -w: Store the file names in the zip archive without compression.
  • -x: Exclude the files from the zip archive.
  • -y: Store symbolic links as the links.
  • -z: Display the zip archive comment.

Examples

Compress files

zip archive.zip file1 file2 file3

Compress directories

zip -r archive.zip directory1 directory2 directory3

Compress files with password

zip -P password archive.zip file1 file2 file3

Compress files with password and encryption

zip -P password -e archive.zip file1 file2 file3

Compress files with password and encryption and split

zip -P password -e -s 100m archive.zip file1 file2 file3

Compress files with password and encryption and split and set timestamp

zip -P password -e -s 100m -T archive.zip file1 file2 file3

Delete files from zip

zip -d archive.zip file1 file2 file3

List files in zip

zip -l archive.zip

Test zip integrity

zip -t archive.zip

Uncompress zip

unzip archive.zip

Uncompress zip to specific path

unzip archive.zip -d /path