Commands.page Logo

How to Check Gzip Compression Statistics in Ubuntu

This article explains how to view compression details for gzip files on Ubuntu. You will learn the specific command used to list compression ratios, original sizes, and compressed sizes directly from the terminal without decompressing the archive.

The Gzip List Command

To display compression statistics for a gzip file, use the -l flag with the gzip command. This option lists the compressed size, uncompressed size, compression ratio, and the file name.

Run the following command in your terminal:

gzip -l filename.gz

Replace filename.gz with the actual path to your compressed file.

Understanding the Output

When you execute the command, the terminal displays a table with four columns:

Verbose Output Option

If you prefer a more detailed view that includes the total sizes for multiple files, add the -v flag for verbose mode.

gzip -lv filename.gz

This provides the same statistics but includes a total line at the bottom if multiple files are specified.