Estimate the size of the extracted files before extraction a `tar.gz` archive?
For gzip
:
$ gzip -l binutils-2.24.tar.gz
compressed uncompressed ratio uncompressed_name
30809913 186997248 83.5% binutils-2.24.tar
Now you see a compressed and an uncompressed size of the content.
Or alternatively use that command:
$ zcat binutils-2.24.tar.gz | wc --bytes
186997248
For bzip2
, there is bzcat
:
$ bzcat binutils-2.24.tar.bz2 | wc -c
186997248
For rar
, use:
$ unrar l archive.rar
...
1 465769002 102749558 22%
In the last line of the output there is the original size in bytes (the second digit).
For zip
, use
$ unzip -l archive.zip
...
700136 4 files
Also the last line (the first digit)
Related videos on Youtube
Tim
Elitists are oppressive, anti-intellectual, ultra-conservative, and cancerous to the society, environment, and humanity. Please help make Stack Exchange a better place. Expose elite supremacy, elitist brutality, and moderation injustice to https://stackoverflow.com/contact (complicit community managers), in comments, to meta, outside Stack Exchange, and by legal actions. Push back and don't let them normalize their behaviors. Changes always happen from the bottom up. Thank you very much! Just a curious self learner. Almost always upvote replies. Thanks for enlightenment! Meanwhile, Corruption and abuses have been rampantly coming from elitists. Supportive comments have been removed and attacks are kept to control the direction of discourse. Outright vicious comments have been removed only to conceal atrocities. Systematic discrimination has been made into policies. Countless users have been harassed, persecuted, and suffocated. Q&A sites are for everyone to learn and grow, not for elitists to indulge abusive oppression, and cover up for each other. https://softwareengineering.stackexchange.com/posts/419086/revisions https://math.meta.stackexchange.com/q/32539/ (https://i.stack.imgur.com/4knYh.png) and https://math.meta.stackexchange.com/q/32548/ (https://i.stack.imgur.com/9gaZ2.png) https://meta.stackexchange.com/posts/353417/timeline (The moderators defended continuous harassment comments showing no reading and understanding of my post) https://cs.stackexchange.com/posts/125651/timeline (a PLT academic had trouble with the books I am reading and disparaged my self learning posts, and a moderator with long abusive history added more insults.) https://stackoverflow.com/posts/61679659/revisions (homework libels) Much more that have happened.
Updated on September 18, 2022Comments
-
Tim over 1 year
Before using
tar
to extract a.tar.gz
archive, it is possible to get an estimate of how large the extracted files are in total?-
Admin over 9 yearsTry
gzip -l archive.tar.gz
-
-
Tim over 9 yearsThanks. WHat if it is other common types' compression files, e.g. .bz, .rar, .zip, ...?
-
PM 2Ring over 9 yearsNote that the methods which use
-l
orl
are much more efficient than the*cat
methods. The former methods simply read the file size data from the archive header, the later methods extract the entire archive contents.