1

I have a 5GB folder with my research from last year. To save space, I compressed the folder, and all its contents. The compressed file *.tar.xz, is 761MB, which seems really tiny. That made me wonder:

How can I verify the contents of the compressed file against the uncompressed directory? Is 761MB really correct? how can I know? Is there an easy way to figure that out? Or, is there something which will give me more details about the compression? ... As in something that might say: Your 5GB folder will 761MB using this compression type....

That information could be really handy to know. Right now, I am using options available for compression via the file manager, caja. I am using mate, Ubuntu 14.04.

command line options are fine too.

  • Although you could list the files and compare a list, IMO the only way to "test" the archive is to extract it and see. – Panther Aug 10 '15 at 2:48
  • Might it be that you have a lot of matrices in there? And many zeros, too? Imagine it this simple way: writing down "repeat 0.0000 'newline' for 1,000,000 times" is shorter than writing these millions of zeros out. I could compress data to 5-10% in many occasions. – Fiximan Aug 10 '15 at 7:32
2

You can use the -d command. Quoting from man tar:

-d, --diff, --compare
   find differences between archive and file system

This might be very time-consuming, though.

Example in action:

$ tar -Jcf bin.tar.xz bin
$ echo foo >> bin/login.sh 
$ tar -Jdf bin.tar.xz
bin/login.sh: Mod time differs
bin/login.sh: Size differs

Or, is there something which will give me more details about the compression? ... As in something that might say: Your 5GB folder will 761MB using this compression type.

In general, the only way to know what size some data will compress to is to actually compress it.

xz is usually good at compression, and if most of your 5 GB was text, it could have compressed well (as opposed to, say PDF files or media files).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.