Commands.page Logo

How to List Zip File Compression Ratio in Ubuntu

This guide explains how to view the compression ratio of individual files inside a zip archive using the Ubuntu terminal. By utilizing the built-in unzip utility with specific verbose flags, you can quickly analyze storage savings without extracting the contents. The following steps provide the exact command syntax and explain how to interpret the resulting data.

To list the compression ratio, you need the unzip utility installed on your system. Most Ubuntu installations include this by default, but if it is missing, you can install it by running sudo apt install unzip. Once ready, open your terminal and navigate to the directory containing your zip file.

The primary command to view detailed archive information is unzip with the -v flag, which stands for verbose. Execute the following command, replacing archive.zip with the name of your file:

unzip -v archive.zip

This command outputs a table listing every file stored within the archive. The last column of this table is labeled Ratio. This value represents the compression percentage achieved for each specific file. A higher percentage indicates better compression, while 0% means the file was stored without compression.

The output columns provide the following data: * Length: The original size of the file before compression. * Size: The compressed size of the file within the archive. * Ratio: The percentage of space saved.

You do not need to extract the files to see this information. This method allows for quick inspection of archive efficiency directly from the command line interface.