Unpacking gz Files

To view a file with the .gz extension it needs to be uncompressed, or unpacked.

Examples of gzip composed files are the log files found in the directory /var/log. In this directory the older log files are stored compressed. To show this they have the .gz extension

For example the syslog files are:

syslog
syslog.1
syslog.2.gz
syslog.3.gz
syslog.4.gz

The gz file extension is used to signify that the file had been compressed using gzip.

To decompress a gzip file there are a number of programs available, including gunzip and gzip.

Either may be used as a simple command with the file name to uncompress the file.

gunzip

gunzip syslog.2.gz
cat syslog.2.gz

gzip

gzip -d syslog.2.gz
cat syslog.2