gzip 檔案的有效負載大小

gzip 檔案的有效負載大小

.gz有沒有辦法在不解壓縮的情況下檢查壓縮資料集( )的正常大小?

例如,我有 50 個大.gz檔案(總共 50 GB),由於儲存問題而無法解壓縮,但我想報告其中有多少正常資料。

答案1

使用該-l選項。從線上說明頁:

   -l --list
         For each compressed file, list the following fields:

             compressed size: size of the compressed file
             uncompressed size: size of the uncompressed file
             ratio: compression ratio (0.0% if unknown)
             uncompressed_name: name of the uncompressed file

即使該選項不可用,您仍然不需要任何儲存空間來解壓縮檔案並測量其大小:

gzip -cd file.gz | wc -c

相關內容