Compress and decompress - use the zip utility to handle .zip files.

Manpage

man zip

The program is useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily compressing unused files or directories.

Online

Compress

The zip command will replace any existing .zip file, but it will add target input files to it and keep the existing files in the zip file. Check the flags to change how this works.

The target can be one or more files or directories.

zip -r ZIPPED_FILE INFILES

e.g.

zip -r foo.zip foo
# Equivalent
zip -r foo foo

zip -r foo.zip a.txt b.py

zip -r bar.zip *.doc

Decompress

zip ZIPPED_FILE [OUTPUT]

e.g.

unzip foo.zip
# => foo/
unzip foo.zip baz.doc

Compress with encryption

zip -r -e data.zip data/