COHERENT manpages
This page displays the COHERENT manpage for gzip [GNU utility to compress files].
List of available manpages
Index
gzip -- Command GNU utility to compress files gzip [ -cdfhLrtvV19 ] [ file ... ] The command gzip is the GNU command that compresses file named on its command line. It will only attempt to compress regular files. Whenever possible, gzip replaces each file with one that has the suffix .gz, while preserving its ownership and times of last access and last modification. If the name of file is longer than 12 characters (which prevents gzip from attaching the suffix .gz), gzip truncates it and keeps its original name within the compressed file. If its command line names no file, gzip compresses what it reads from from the standard input, and writes it to the standard output. To restore a compressed file, filter it thorugh the command gunzip. gzip uses the Lempel-Ziv algorithm to perform compression. Under most circumstances, this algorithm compresses files more tightly than do most other commonly used techniques, such as the LZW algorithm, Huffman coding, or adaptive Huffman coding. The amount of compression obtained depends upon the size of the input and the distribution of common substrings; in general, it reduces text by 60% to 70%. gzip always compresses its input, even if the compressed file is slightly larger than the original. The worst-case expansion is a few bytes for the gzip file header, plus five bytes for every 32-kilobyte block. Command-Line Options gzip recognizes the following command-line options: -c Write output to standard output, and do not change the original file. If the command line names more than one file, gzip writes to the standard output a sequence of independently compressed members. To obtain better compression, concatenate the files before compressing them. -d Decompress each file. -f force compression or decompression, even if file has multiple links or the corresponding file already exists. Without this option, and when not running in the background, gzip prompts to verify whether it should overwrite an existing file. -h Help: display a screenful of information on how to run this program. -L Display the gzip license. -q Suppress all warning messages. -r Recurse: if a file is a directory, compress or uncompress all files within it. -t Test: check the integrity of a compressed file. -v Verbose: display the name and percentage reduction for each file as it is compressed. -V Display the version of this command, and the options by which it was compiled. 1-9 Regulate the speed of compression, on a scale of from 1 to 9. 1 performs the fastest but most superficial compression, whereas 9 performs the slowest but most thorough compression. -fast is a synonym for -1, whereas -best is a synonym for -9. The default compression level is -5. Advanced Usage You can concatenate multiple compressed files. In this case, gunzip extracts all members at once. For example: gzip -c file1 > foo.gz gzip -c file2 >> foo.gz gunzip -c foo is equivalent to: cat file1 file2 In case of damage to one member of a .gz file, other members can still be recovered (if the damaged member is removed). However, you can get better compression by compressing all members at once: cat file1 file2 | gzip > foo.gz compresses better than: gzip -c file1 file2 > foo.gz If you want to recompress concatenated files to get better compression, type: zcat old.gz | gzip > new.gz Environment gzip reads the environment variable GZIP for its default options. It interprets these options first; you can override them by setting other options on the gzip command line. See Also commands, compress, compression, gunzip, uncompress, unpack, zcmp, zdiff, zforce, zgrep, zmore, znew Diagnostics If all went well, gzip returns zero upon exiting. If an error occurred, it returns one; if it issued a warning message, it returns two. gzip can issue the following warning messages: Usage: gzip [-cdfhLrtvV19] [file ...] The gzip command line contained an option that gzip does not recognize. file: already has z suffix -- no change file already has the suffix .gz; therefore, gzip assumes that it already is compressed. file not a regular file or directory: ignored A file is not a regular file or directory. gzip does not attempt to compress devices, pipes, or other special files. file has XX other links: unchanged file has more than one link. By default, gzip does not compress a file that has multiple links. Notes gzip is released under the conditions of the Free Software Foundation's ``copyleft''. Full source code is available through the Mark Williams bulletin board.