gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip – compress and expand data

gzip [–cvD[1–9]] [file ...]

gunzip [–ctTvD] [file ...]

bzip2 [–cvD[1–9]] [file ...]

bunzip2 [–cvD] [file ...]

compress [ –cv ] [ file ... ]

uncompress [ –cv ] [ file ... ]

zip [–avD[1–9]] [–f zipfile] file [...]

unzip [–cistTvD] [–f zipfile] [file ...]


Gzip encodes files with a hybrid Lempel–Ziv 1977 and Huffman compression algorithm known as deflate. Most of the time, the resulting file is smaller, and will never be much bigger. Output files are named by taking the last path element of each file argument and appending .gz; if the resulting name ends with .tar.gz, it is converted to .tgz instead. Gunzip reverses the process. Its output files are named by taking the last path element of each file argument, converting .tgz to .tar.gz, and stripping any .gz; the resulting name must be different from the original name.

Bzip2 and bunzip2 are similar in interface to gzip and gunzip, but use a modified Burrows–Wheeler block sorting compression algorithm. The default suffix for output files is .bz2, with .tar.bz2 becoming .tbz. Bunzip2 recognizes the extension .tbz2 as a synonym for .tbz.

Compress and uncompress are similar in interface to gzip and gunzip, but use the Lempel–Ziv–Welch compression algorithm. The default suffix for output files is .Z. Compress is one of the oldest widespread Unix compression programs.

Zip encodes the named files and places the results into the archive zipfile, or the standard output if no file is given. Unzip extracts files from an archive created by zip. If no files are named as arguments, all of files in the archive are extracted. A directory's name implies all recursively contained files and subdirectories. Zip is the de facto standard for compression on Microsoft operating systems.

None of these programs removes the original files. If the process fails, the faulty output files are removed.

The options are:
a      Automaticialy creates directories as needed, needed for zip files created by broken implementations which omit directories.
c      Write to standard output rather than creating an output file.
i      Convert all archive file names to lower case.
s      Streaming mode. Looks at the file data adjacent to each compressed file rather than seeking in the central file directory. This is the mode used by unzip if no zipfile is specified. If –s is given, –T is ignored.
t      List matching files in the archive rather than extracting them.
T      Set the output time to that specified in the archive.
1 .. –9Sets the compression level. –1 is tuned for speed, –9 for minimal output size. The best compromise is –6, the default.
v      Produce more descriptive output. With –t, adds the uncompressed size in bytes and the modification time to the output. Without –t, prints the names of files on standard error as they are compressed or decompressed.
D      Produce debugging output.


"A Technique for High Performance Data Compression", Terry A. Welch, IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8–19.

Unzip can only extract files which are uncompressed or compressed with the deflate compression scheme. Recent zip files fall into this category. Very recent zip files may have tables of contents that unzip cannot read. Such files are still readable by invoking unzip with the –s option.
Copyright © 2024 Alcatel-Lucent. All rights reserved.