How can I extract the size of the total uncompressed file data in a .tar.gz file from command line?
相关问题
- How do I build a debian package whose sources incl
- excluding some folders in tar command not work
- How do I signal to a web server that I'm posti
- Express: Serve pre-compressed static assets
- gzip raised OverflowError: Size does not fit in an
相关文章
- TAR encode/decode library for iPhone (ideally coco
- Fiddler doesn't decompress gzip responses
- Downloading a csv.gz file from url in Python
- IE8 not sending Accept-Encoding: gzip, deflate
- PHP - compress static css file with GZIP
- Decompressing a gzipped payload of a packet with P
- How is codeload.github.com different to api.github
- Android Decompress downloaded .xml.gz file
This will sum the total content size of the extracted files:
The output is given in bytes.
Explanation:
tar tzvf
lists the files in the archive in verbose format likels -l
.sed
andcut
isolate the file size field. The secondsed
puts a + in front of every size except the first andpaste
concatenates them, giving a sum expression that is then evaluated bybc
.Note that this doesn't include metadata, so the disk space taken up by the files when you extract them is going to be larger - potentially many times larger if you have a lot of very small files.
If you want to do this from the command-line, you could try the -l option to gzip:
I'm finding everything sites in the web, and don't resolve this problem the get size when file size is bigger of 4GB.
first, which is most faster?
definitely, tar -xvf is the most faster, but ¿how to cancel executions after get header?
my solution is this:
The command
gzip -l archive.tar.gz
doesn't work correctly with file sizes greater than 2Gb. I would recommendzcat archive.tar.gz | wc --bytes
instead for really large files.Use the following command:
A tar file is uncompressed until/unless it is filtered through another program, such as gzip, bzip2, lzip, compress, lzma, etc. The file size of the tar file is the same as the extracted files, with probably less than 1kb of header info added in to make it a valid tarball.