Differences between bz2 and. gz files in Linux systems

Source: Internet
Author: User
Keywords Difference linux .bz2 .gz
Tags .gz aliyun bzip2 difference differences file files gnu

The common compressed file format under UNIX is generated by a compression tool with a high compression rate, followed by a compressed file with a. bz2 end bzip2.

GZ is a compressed file in a Unix system, a GNU version of Zip, and features the same compressed files as WinRAR.

BZ2 and. GZ are all formatted as compressed files under Linux, somewhat similar to. zip and. rar files under Windows.
&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;
The difference between bz2 and. GZ is that the former has a higher compression rate than the latter, which takes less time than the former. That is, the same file, after compression, the. bz2 file is smaller than the. gz file, but the. bz2 file is small at the cost of more time.

Compress instance: Compress a 599M folder workspace

-----------bz2 File----------------------
Time TAR-JCVF j.tar.bz2 workspace/
340M 56.8%
Real 13m20.975s
User 11m13.872s
SYS 0m5.985s

-----------GZ File----------------------
Time TAR-ZCVF z.tar.gz workspace/
348M 58.1%
Real 2m10.305s
User 0m54.228s
SYS 0m7.399s
---------------------------------

Summary: After compression, the. bz2 file is only 8M smaller than the. gz file, but it takes 6 times times more time. Of course, the compression ratio, time and compressed file format, size and other factors. Therefore, this example does not show that using GZ is more cost-effective than using bz2, but at least it can be proved that bz2 is higher than the GZ compression rate, and GZ takes less time than bz2.

Compression rates and file types have a significant impact. Some files bz2 compression rate than GZ, but some files bz2 can compress more than GZ two times! As for the size of the file, there is a classic phrase: Although the disk is getting cheaper, but network bandwidth is not so cheap, it is often worthwhile to use smaller files to conserve network bandwidth.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.