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.gzReplace 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:
- compressed: The size of the file after compression.
- uncompressed: The original size of the file before compression.
- ratio: The percentage of space saved by compression.
- uncompressed_name: The name of the original file.
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.gzThis provides the same statistics but includes a total line at the bottom if multiple files are specified.