zip flags & options

-r

Recursively include directories and their contents.

zip -r archive.zip project/

-e

Encrypt the archive with a password.

zip -e -r secure.zip secrets/

-x

Exclude files matching a pattern.

zip -r archive.zip project/ -x "*.git*" -x "node_modules/*"

-9

Maximum compression (slowest). Use -1 for fastest (least compression).

zip -9 -r archive.zip project/

-d

Delete entries from an existing archive.

zip -d archive.zip "unwanted-file.txt"

-u

Update existing entries and add new files only if newer.

zip -u archive.zip newfile.txt

-j

Junk (strip) directory paths, storing only filenames.

zip -j flat.zip path/to/file1 path/to/file2

-q

Quiet mode. Suppress output.

zip -qr archive.zip project/

-l

Convert line endings to CRLF (Unix to Windows).

zip -l archive.zip textfile.txt

unzip -l

List contents of a zip archive (unzip command, not zip).

unzip -l archive.zip

unzip -d

Extract to a specific directory.

unzip archive.zip -d /tmp/output