Sponsored Content
Operating Systems Linux Red Hat Compression ratios of .tbz file Post 302554790 by pludi on Tuesday 13th of September 2011 04:59:38 AM
Old 09-13-2011
In short: no.
tar doesn't compress anything, it's just an archiver, meaning it combines a list of files (including meta information like access times, permissions, ...) into one larger file. As a bonus it supports passing this file stream through a compression utility like gzip or bzip2. These 2 commands are completely equal, and the resulting files usually even have the same checksum:
Code:
# tar -cf - directory | bzip2 -c > archive.tbz
# tar -cjf archive.tbz directory

One way to get the ratio would be by getting the sizes of the original and the compressed file with du, and feeding it to bc:
Code:
orig=$( du -k directory )
comp=$( du -k archive.tbz )
ratio=$( echo "scale=5; $comp/$orig*100" | bc )

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file compression

Is it possible to unzip / compress a file that was zipped using WinZip? thanks, kristy (2 Replies)
Discussion started by: kristy
2 Replies

2. UNIX for Dummies Questions & Answers

.z file compression

Hello, I have a .z file which i understand to be UNIX. I'm on PC (no UNIX boxes) and have tried many different unzipping programs to extract this .z file, but only PicoZip has allowed me to view what is inside (telling me, i think, that it's not corrupt), but i have not been able to extract... (3 Replies)
Discussion started by: Gonecat
3 Replies

3. Linux

Clearning space - File compression issue

Hi, We have access to 2 filesystems: Filesystem Size Used Avail Use% Mounted on /dev/mapper/system-oraoid 30G 30G 119M 100% /app /dev/mapper/system-tmp 2.0G 442M 1.6G 22% /tmp As you can observe the file system on /app is full. In order to recover... (2 Replies)
Discussion started by: animesh303
2 Replies

4. Shell Programming and Scripting

file compression

I'am looking for script (or tool) that would compress all files with given extension in all subdirectory. Important part is that every one file have to end in separate archive whit it's own name. Eaven if I could point multiple file in one directory and compress them it would be ok. I' am... (1 Reply)
Discussion started by: Demerzel
1 Replies

5. Red Hat

file roller compression problems with 7z

Can some please tell me why I can't make a 7z archive with file roller? I have already installed p7zip, p7zip-plugins, and 7za. I don't understand what the problem is. I can make a 7z archive from the command line with no problems. I keep getting this message but it doesn't tell me what the error... (0 Replies)
Discussion started by: cokedude
0 Replies

6. Linux

Best Compression technique ?

Hi all, I am working on a sample backup code, where i read the files per 7200 bytes and send it to server. Before sending to server, i compress each 7200 bytes using zlib compression algorithm using dictionary max length of 1.5 MB . I find zlib is slow. Can anyone recommend me a... (3 Replies)
Discussion started by: selvarajvss
3 Replies

7. UNIX for Advanced & Expert Users

Compression with openssl

Hi , 1-I need to know please if it's possible to compress using openssl? Here is the version used: openssl version -a OpenSSL 0.9.7d 17 Mar 2004 (+ security fixes for: CVE-2005-2969 CVE-2006-2937 CVE-2006-2940 CVE2006-3738 CVE-2006-4339 CVE-2006-4343 CVE-2007-5135 CVE-2008-5077... (3 Replies)
Discussion started by: Eman_in_forum
3 Replies

8. Programming

Calculate ratios for each pair in a given file

Hello, My input file looks like this #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Individual1 Individual2 Individual3 Individual4 Individual5 Individual6 22 10000 ID1 A ... (0 Replies)
Discussion started by: nans
0 Replies
BZNEW(1)						      General Commands Manual							  BZNEW(1)

NAME
bznew - recompress .gz or .tgz files to .bz2 files SYNOPSIS
bznew [ -ftv9PK] [ name.gz ... ] DESCRIPTION
Bznew recompresses files from .gz (gzip) format to .bz2 (bzip2) format. If you want to recompress a file already in bzip2 format, rename the file to force a .bz2 extension then apply bznew. OPTIONS
-f Force recompression from .gz to .bz2 format even if a .bz2 file already exists. -t Tests the new files before deleting originals. -v Verbose. Display the name and percentage reduction for each file compressed. -9 Use the slowest compression method (optimal compression). -P Use pipes for the conversion to reduce disk space usage. -K Keep a .gz file when it is smaller than the .bz2 file SEE ALSO
bzip2(1), gzip(1) BUGS
Bznew does not maintain the time stamp with the -P option if cpmod(1) is not available and touch(1) does not support the -r option. BZNEW(1)
All times are GMT -4. The time now is 08:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy