Home   |   Guides and Tutorials   |   What's New?   |   Comments   |   About
 

gzip and gunzip: Files With .gz Extensions

by Brent Fox
Last Modified: Wednesday, 19-May-2004 11:55:34 EDT

Introduction
    gzip and gunzip are GNU file compression and decompression utilities. Usually, files that have been compressed by gzip will have a .gz extension. However, sometimes you may see a file that has a .tgz extension. This is a TAR file that has been compressed by gzip. The .tgz extension is a shorthand version for the .tar.gz extension. This type of file must be uncompressed with gunzip before it can be untarred. However, there is a way to use the tar command to uncompress the file and untar it at the same time. For more information, see the tar: Tape Archive Files guide.

Uncompressing a gzip File Using gunzip
    To uncompress a gzip file, execute the following command:
gunzip filename.txt.gz     (where filename.txt.gz is the name of the file you wish to uncompress)
The result of this operation is a file called filename.txt. By default, gunzip will delete the filename.txt.gz file.

Compressing a File Using gzip
    To compress a file using gzip, execute the following command:
gzip filename.txt     (where filename.txt is the name of the file you wish to compress)
The result of this operation is a file called filename.txt.gz. By default, gzip will delete the filename.txt file.

What's Related


All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004