The gzip (GNU zip) utility is a software package for compressing files. It was originally designed to replace compress, as it does a better job with compression and it is free from patented algorithms.

A .gz extension is created when gzip is used to compress files. Compressing files reduces the overall size and this is done via the Lempel-Ziv coding in gzip.

Decompressing files created by gzip, compress or pack is as simple as using gunzip.

When a file is compressed, it is replaced by one with the .gz file extension. Ownership modes, access and modification times are all preserved.


To unpacking, decompress or extract files from a file with a .gz extension you need to use gunzip or gzip -d.

To use the gunzip command, type:
gunzip filename.gz

To use the gzip -d command, type:
gzip -d filename.gz
$ ls file

If the file extension happens to end in .tar.gz use the tar command by typing:
tar -zxvf filename.tar.gz

For more information on file compression, read the Ubuntu Documentation on file compression.

FYI: gunzip can decompress files created by the gzip, zip, compress, compress -H and pack software packages.