15.4 zip

Finally, there are two utilities that can be used on zip files. These are very common in the Windows world, so Linux has programs to deal with them. The compression program is called zip(1), and the decompression program is called unzip(1).

% zip foo *

This will create the file foo.zip, which will contain all the files in the current directory. zip will add the .zip extension automatically, so there's no need to include that in the file name. You can also recurse through the current directory, zipping up any directories that are also laying around:

% zip -r foo *

Decompressing files is easy, as well.

% unzip foo.zip

This will extract all the files in the file foo.zip, including any directories in the archive.

The zip utilities have several advanced options for creating self-extracting archives, leaving out files, controlling compressed file size, printing out what will happen, and much more. See the man pages for zip and unzip to find out how to use these options.