Cheat Sheet #day63 - zip

zip Command Cheatsheet
The zip command is used to compress files into a ZIP archive. It is a popular utility for archiving and compressing files in Unix-like systems. Here’s a quick reference guide:
Basic Syntax
zip [OPTION]... ZIP_FILE FILE...
Common Options
-r,--recurse-paths: Recursively include directories and their contents.zip -r archive.zip directory/-e,--encrypt: Encrypt the archive with a password.zip -e archive.zip file.txt-9,--best: Use the best compression method.zip -9 archive.zip file.txt-0,--store: Store files without compression.zip -0 archive.zip file.txt-q,--quiet: Suppress all output except errors.zip -q archive.zip file.txt-x,--exclude: Exclude files matching the pattern.zip -r archive.zip * -x "*.bak"-j,--junk-paths: Do not store the full pathnames.zip -j archive.zip directory/*-d,--delete: Delete files from the archive.zip -d archive.zip file.txt-l,--local: Store symbolic links as symbolic links.zip -l archive.zip link.txt
Examples
Create a ZIP archive with files:
zip archive.zip file1.txt file2.txtCompress a directory recursively:
zip -r archive.zip directory/Encrypt an archive with a password:
zip -e archive.zip file.txtUse maximum compression:
zip -9 archive.zip file.txtStore files without compression:
zip -0 archive.zip file.txtSuppress output except errors:
zip -q archive.zip file.txtExclude files matching a pattern:
zip -r archive.zip * -x "*.bak"Store files without full pathnames:
zip -j archive.zip directory/*Delete a file from an archive:
zip -d archive.zip file.txtStore symbolic links as links:
zip -l archive.zip link.txt
Additional Information
Help option:
zip --helpView
zipmanual page:man zip
This cheatsheet covers the essential options and usage scenarios for the zip command. For more detailed information, refer to the man page or use zip --help.




