How to Compress, Uncompress to .gz, .bz2?

Tar (tape archive) does not compress files. They are used for grouping all files in a folder so that it can be transferred across locations. In order to compress the files, you need to use zip, gzip or bzip2 utilities.

gzip, bzip2 are file compression utilities and gunzip, bunzip2 are file uncompression utilities.

bzip2 compresses files to a smaller size compared to gzip, but it takes longer to compress the files. Bzip2 uses Burrows-Wheeler block sorting text compression algorithm (with Huffman coding) and gzip uses Lempel-Ziv coding. so, a file compressed with one utility cannot be uncompressed with the other utility.

Compressing files
$ gzip myfile1.doc.gz
$ bzip2 myfile2.doc.bz2

Now compare the file sizes to verify the reduction in compression ratios.

Uncompressing files
$ gunzip myfile1.doc.gz
$ bunzip2 myfile2.doc.gz

Read more on Gunzip, Unzip, Bunzip with tar

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Written by kurinchilamp

Website: http://

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
Apache: client denied by server configuration error

Apache Error log shows the message "Client denied by server configuration" and the user sees "Forbidden Access" when they try...