*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: gzip | Section: 1 | Source: Digital UNIX | File: gzip.1.gz
gzip(1) General Commands Manual gzip(1) NAME gzip, gunzip - Compresses or expands files. SYNOPSIS gzip [-acdfhlLnNrtvV19] [-S suffix] [name...] gunzip [-acfhlLnNrtvV] [-S suffix] [name...] OPTIONS Specifies ascii text mode; converts end-of-lines using local conven- tions. This option is supported only on some nonUnix systems. For MS- DOS, CR LF is converted to LF when compressing, and LF is converted to CR LF when decompressing. Writes output on standard output; keeps original files unchanged. If there are several input files, the output consists of a sequence of independently compressed members. To obtain better compression, concatenate all input files before compressing them. Specifies an uncompress operation. Force compression or decom- pression even if the file has multiple links or the corresponding file already exists, or if the compressed data is read from or written to a terminal. If the input data is not in a format recognized by the gzip command, and if the -c option is also specified, copy the input data without change to the standard output. That is, let the zcat command behave as the cat command. If the -f option is not specified, and when not running in the background, the gzip command prompts to verify whether an existing file should be overwritten. Displays a help screen and quits. Lists the following fields for each compressed file: Speci- fies size of the compressed file. Specifies size of the uncompressed file. Specifies compression ratio (or 0.0% if unknown). Specifies the name of the uncompressed file. The uncompressed size is given as -1 for files that are not in the gzip format, such as compressed files. When used with the -v option, the fields are also displayed: Specifies compression method. Specifies the 32-bit CRC of the uncompressed data. Specifies the time stamp for the uncom- pressed file. The compression methods currently supported are deflate, com- press, lzh (SCO compress -H) and pack. The crc is given as ffffffff for a file that is not in the gzip format. When used with the -N option, the uncompressed name and the date and time are those stored within the compress file if present. When used with the -v option, the size totals and compression ratio for all files is also displayed, unless some sizes are un- known. When the -q option is specified, the title and totals lines are not displayed. Displays the gzip license and quits. Specifies that the original filename and time stamp are not saved when compressing by default. (The original name is always saved if the name had to be truncated.) When decompressing, do not restore the original filename if present (remove only the gzip suffix from the compressed filename) and do not restore the original time stamp if present (copy it from the compressed file). This option is the default when decompressing. Specifies that when compressing, always save the original filename and time stamp; this is the default. When decompressing, restore the original filename and time stamp if present. This option is useful on systems which have a limit on file name length or when the time stamp has been lost after a file transfer. Suppresses all warnings. Travels the directory structure recursively. If any of the filenames specified on the command line are directo- ries, the gzip command descends into the directory and com- presses all the files it finds there (or decompresses them in the case of the gunzip command). Uses the suffix instead of and should be avoided to remove confusion when files are transferred to other systems. A null suffix forces the gunzip command to attempt decompressing all given files regardless of the suffix as follows: gunzip -S * (*.* for MSDOS) Previous versions of the gzip command used the suffix. This was changed to avoid a conflict with the pack command. Specifies that the compressed file's integrity be tested. Specifies ver- bose mode. Displays the name and percentage reduction for each file compressed or decompressed. Specifies the version number and compilation options and then quits. Regulates the speed of compression using the specified digit #, where -1 or --fast in- dicates the fastest compression method (less compression) and -9 or --best indicates the slowest compression method (best com- pression). The default compression level is -6 (that is, biased towards high compression at expense of speed). DESCRIPTION The gzip command reduces the size of specified files using the Lempel- Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension modes, access and modification times. If files are not specified, or if a file name is "-", the standard in- put is compressed to the standard output. The gzip command only at- tempts to compress regular files. In particular, it ignores symbolic links. By default, the gzip command keeps the original file name and time stamp in the compressed file. These are used when decompressing the file with the -N option. This is useful when the compressed filename was truncated or when the time stamp was not preserved after a file transfer. Compressed files can be restored to their original form using the gzip command with the -d option, or by using the gunzip command. The gunzip command takes a list of specified files and replaces each file that begins with the correct magic number and whose name ends with -gz, -z, _z or with an uncompressed file without the original exten- sion. The gunzip command also recognizes the special extensions and as shorthands for and respectively. When compressing, the gzip command uses the extension if necessary instead of truncating a file with a ex- tension. The gunzip command can currently decompress files that are created by the gzip, zip, compress, compress -H or pack commands. The detection of the input format is automatic. When using the first two formats, the gunzip command checks a 32bit CRC. For the pack commands, the gunzip command checks the uncompressed length. Although the standard compress format was not designed to allow consistency checks, the gunzip command is sometimes able to detect a bad file. If you get an error when uncom- pressing a file, do not assume that the file is correct the standard uncompress command does not complain. This probably means that the standard uncompress command did not its input, and the output generated is not useful. The gzip command uses the Lempel-Ziv algorithm used in the zip and PKZIP commands. The amount of compression obtained depends on the size of the input and the distribution of common substrings. Typically, text such as source code or English is reduced by 60-70%. Compression is generally much better than that achieved by LZW (as used in the compress command), Huffman coding (as used in the pack command), or adaptive Huffman coding (in the compact command). Compression is always performed, 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 5 bytes every 32K block, or an ex- pansion ratio of 0.015% for large files. Note that the actual number of used disk blocks almost never increases. The gzip command preserves the mode, ownership and time stamps of files when compressing or decom- pressing. Advanced Usage Multiple compressed files can be concatenated. In this case, the gunzip command extracts all members at once. For example: gzip -c file1 > foo.gz ogzip -c file2 >> foo.gz Using the previous example, gunzip -c foo is equivalent to cat file1 file2. In case a member of a file is damaged, other members can still be re- covered (if the damaged member is removed). However, you gain better compression by compressing all members at once as follows: cat file1 file2 | gzip > foo.gz The previous command line compresses better than the following: gzip -c file1 file2 > foo.gz If you want to recompress concatenated files to gain better compres- sion, do the following: gzip -cd old.gz | gzip > new.gz If a compressed file consists of several members, the uncompressed size and CRC reported by the -l option applies to the last member only. If you need the uncompressed size for all members, use the following: gzip -cd file.gz | wc -c To create a single archive file with multiple members so that members can later be extracted independently, use an archiver such as the tar or zip commands. GNU tar supports the -z option to invoke the gzip com- mand transparently. The gzip command is designed as a complement to the tar command, not as a replacement. Environment The environment variable GZIP can hold a set of default options for the gzip command. These options are interpreted first and can be overwrit- ten by explicit command line options as follows. GZIP="-8v --name"; export GZIP (for sh) setenv GZIP "-8v --name" (for csh) RESTRICTIONS When writing compressed data to a tape, it is generally necessary to pad the output with zeroes up to a block boundary. When the data is read and the whole block is passed to the gunzip command for decompres- sion, the gunzip command detects that there is extra trailing garbage after the compressed data and emits a warning by default. You have to use the -q option to suppress warnings. This option can be set in the GZIP environment variable as follows: GZIP="-q" tar -xfz --block-compress /dev/rst0 (for sh) (setenv GZIP -q; tar -xfz --block-compr /dev/rst0 (for csh) In the previous example, the gzip command is invoked implicitly by the -z option the GNU tar command. Make sure that the same block size (-b option of the tar command) is used for reading and writing compressed data on tapes. (This example assumes you are using the GNU version of the tar command.) The --list flag reports incorrect sizes if they exceed 2 gigabytes. The --list flag reports sizes as -1 and crc as ffffffff if the compressed file is on a nonseekable media. In some rare cases, the --best flag gives worse compression than the default compression level (-6). On some highly redundant files, the compress command compresses better than gzip command. [DIGITAL] The gzip command may not preserve the extended file attrib- utes (property list) of a file, including any access control lists (ACL). Verify that any ACLs are not removed or modified by using gzip. EXIT STATUS Success. An error occurred. A warning is encountered. SEE ALSO Commands: compress(1), pack(1) Files: acl(4) gzip(1)

Navigation Options