home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


gzip [options ] [files ]

GNU Zip. Reduce the size of one or more files using Lempel-Ziv (LZ77) coding, and move to file .gz . Restore with gunzip . With a filename of - , or with no files , gzip reads standard input. Usually, compression is considerably better than that provided by compress . Furthermore, the algorithm is patent-free.

gzip ignores symbolic links. The original file's name, permissions, and modification time are stored in the compressed file, and restored when the file is uncompressed. gzip is capable of uncompressing files that were compressed with compress , pack , or the BSD compact . Default options may be placed in the environment variable GZIP .

gunzip is equivalent to gzip -d . It is typically a hard link to the gzip command. gzcat and zcat are equivalent to gunzip -c , and are also often hard links to gzip .

Note: while not distributed with SVR4 or Solaris, gzip is the de facto standard file compression program for files available over the Internet. Source code can be obtained from the Free Software Foundation (http://www.gnu.org ). Precompiled binaries for Solaris can be obtained from http://www.sunfreeware.com . gzip also has its own web site: see http://www.gzip.org .


Like most GNU programs, gzip has both short and long versions of its command-line options:

-a , --ascii

ASCII text mode: convert end-of-lines using local conventions. Not supported on all systems.

-c , --stdout , --to-stdout

Write output on standard output; keep original files unchanged. Individual input files are compressed separately; for better compression, concatenate all the input files first.

-d , --decompress , --uncompress


-f , --force

Force. The file is compressed or decompressed, even if the target file exists or if the file has multiple links.

-h , --help

Display a help screen and exit.

-l , --list

List the compressed and uncompressed sizes, the compression ratio, and the original name of the file for each compressed file. With --verbose , also list the compression method, the 32-bit CRC, and the original file's last-modification time. With --quiet , the title and totals lines are not displayed.

-L , --license

Display the gzip license and quit.

-n , --no-name

For gzip , do not save the original filename and modification time in the compressed file. For gunzip , do not restore the original name and modification time; use those of the compressed file (this is the default).

-N , --name

For gzip , save the original filename and modification time in the compressed file (this is the default). For gunzip , restore the original filename and modification time based on the information in the compressed file.

-q , --quiet

Suppress all warnings.

-r , --recursive

Recursively walk the current directory tree and compress (for gunzip , uncompress) all files found.

-S .suf , --suffix .suf

Use .suf as the suffix instead of .gz . A null suffix makes gunzip attempt decompression on all named files, no matter what their suffix.

-t , --test

Check the compressed file integrity.

-v , --verbose

Display the name and percentage reduction for each file compressed or decompressed.

-V , --version

Display the version number and compilation options, and then quit.

- n , --fast , --best

Control the compression method. n is a number between 1 and 9. -1 (same as --fast ) gives the fastest, but least compressed method. -9 (same as --best ) gives the best compression, but is slower. Values between 1 and 9 vary the tradeoff in compression method. The default compression level is -6 , which gives better compression at some expense in speed. In practice, the default is excellent, and you should not need to use these options.

Previous: Reference: gzcat UNIX in a Nutshell: System V Edition Next: Reference: head
Reference: gzcat Book Index Reference: head

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System