Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tar.xz - how to check uncompressed files size without decompress whole archive

Tags:

linux

gzip

tar

xz

I have a problem with checking uncompressed size from archive tar.xz without extract whole archive. I know that for tar.gz I can use gzip or zcat but for tar.xz it dosnt work.

Any sugestion how to do this ?

like image 554
simon Avatar asked Sep 19 '25 16:09

simon


2 Answers

xz -l file.xz will give you the compressed/uncompressed sizes of the archive in a human-readable way (KiB MiB suffixes) without actually decompressing (no CPU or disk load). It won't list the files inside the tar archive, though.

xz -lv file.xz is verbose, and you can filter it to get the exact sizes in bytes.

like image 169
Lucas Vinicius Hartmann Avatar answered Sep 22 '25 09:09

Lucas Vinicius Hartmann


tar tvfa <file> will give you a list including file sizes. Check man tar for details. You should also note, that file size does not equate to disk usage, since part of a file can take a full file system block.

like image 36
Bob Goddard Avatar answered Sep 22 '25 08:09

Bob Goddard