How to List Compression Ratio of Files in Ubuntu Archive
Managing storage efficiency is essential for Ubuntu users dealing with large datasets. This article provides direct commands to inspect how well files are compressed within common archive formats. You will learn how to view compression ratios for ZIP and GZIP archives using standard terminal tools without needing extra software.
To view the compression ratio of individual files within a ZIP archive, open your terminal and run the following command:
unzip -v filename.zipThe output includes a column labeled “Ratio” which shows the compression percentage for each file stored inside the archive. This method works without extracting any data.
For GZIP compressed files, the compression applies to the entire stream rather than individual files. To check the ratio of the archive itself, use:
gzip -l filename.gzThis displays the compressed size, uncompressed size, and the overall
compression ratio. If you are working with a .tar.gz file,
this command shows the ratio for the whole tarball. To simply list the
uncompressed sizes of files inside a tar archive without seeing
compression ratios per file, use:
tar -tvf filename.tar.gzFor detailed per-file compression metrics, converting your archive to ZIP format is recommended as it stores this metadata explicitly.