Solved

Compression ratio of .tbz

Posted on 2011-09-13
3
295 Views
Last Modified: 2012-05-12
Hi,

I have a question about finding the compression ratios of a zip (bzip2) file.I have written a procedure which upon certain criteria tar and bzip2 certain directories and moves them to a near line storage.

Yesterday I happened to stumble upon it. The procedure has tar and bzipped 6 GB of data to 800MB. Is there any attribute in tar command which would yield a summary of the compression.
Though I have gone through the man page of tar, I have not found anything affirmative.

Thanks in advance
0
Comment
Question by:Peddu_bhanu
3 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36528088
Do you mean the compression ratio of an existing archive?

This should be possible with

bzip2 -tv archive.tbz

Or do you want to show the ratios during compression?

I think this could be achieved with the tar parameter --use-compress-program="bzip2 -v"

wmp
0
 
LVL 1

Author Comment

by:Peddu_bhanu
ID: 36529057
No joy. Doesn't work. It only checks the integrity
0
 
LVL 1

Accepted Solution

by:
TiCpu earned 500 total points
ID: 36934476
Using --use-compress-program would show the compression ratio at the output of tar.
If you don't use GNU tar you could also pipe to bzip2 -v
Ex.: tar -cf - somedir/ | bzip2 -v > somedir.tar.bz2

Else use xz, xz -l will show the compression ratio and compress better.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now