Zip

zip Article description::provides classic zip compression. It is handy for cross-platform compatibility with Microsoft operating systems. Newer versions of zip include support for Unicode and encryption. These can be enabled or disabled at built time on Gentoo systems by their respective USE flags (see below).

The equal and opposite program to zip is unzip, which is included in a separate package.

Emerge
After adjusting USE flags:

Optionally  for unzip capabilities (see the unzip article for more information).

Environment variables
zip does not have any configuration files, however its operation is modifiable by the following environment variables:


 * ZIPOPT - Can be used to set any option for the command.
 * ZIP - Does the exact same thing as the ZIPOPT variable (directly above).
 * Zip$Options - For RISC OS use. Does the exact same thing as the ZIPOPT variable (directly above).
 * Zip$Exts - For RISC OS use. Contains extensions separated by a   (colon) that will cause native filenames with one of the specified extensions to be added to the zip file with basename and extension swapped.
 * ZIP_OPTS - For VMS use. Does the exact same thing as the ZIPOPT variable.

Usage
ZIP a file Creates the archive data.zip and puts all the files in the current directory in it in compressed form, type:

Note: No need to add .zip extension or suffix as it is added automatically by zip command.

To zip up an entire directory (including all subdirectories), type the following command:

It is possible to zip a file and save the zip file in another directory by indicating the new destination path with the name of the zip file at the end.

You can also try -9 option for best compressionː

Update one file or more files of the compressed archive, suppose we have compressed an archive then, modified a file. There is a possibility to add the update file to the compressed archive with the zip -u command.

You can replace (freshen) an existing entry in the zip archive only if it has been modified more recently than the version already in the zip archive. Unlike the update option, this will not add files that are not already in the zip archive.

External resources

 * How are zlib, gzip and Zip related? What do they have in common and how are they different? (stackoverflow.com)