Sunday, October 28, 2007

Get Better Compression with bzip2 Command - UNIX

I was trying out the bzip2 compression command. I did notice better compression rates with larger files (testing large tarballs) compared to gzip or compress. But it does take quite a bit of time to perform the compression. Here's one run I did.

# ls -l mytest20.tar
-rw-r--r-- 1 root other 50747392 Oct 28 23:58 mytest20.tar
# gzip mytest20.tar
# ls -l mytest20.tar.gz
-rw-r--r-- 1 root other 9763163 Oct 28 23:58 mytest20.tar.gz
# gunzip mytest20.tar.gz
# bzip2 mytest20.tar
# ls -l mytest20.tar.bz2
-rw-r--r-- 1 root other 5757170 Oct 28 23:58 mytest20.tar.bz2

To uncompress use bunzip2 or bzip2 -d
# bunzip2 mytest20.tar.bz2
# ls -l mytest20.tar
-rw-r--r-- 1 root other 50747392 Oct 28 23:58 mytest20.tar

No comments: