Differences between .bz2and .gz files in the CentOS command

Source: Internet
Author: User
Both .bz2and .gzare the format of the compressed file under linux, which includes the. zip and. rar files under Windows .. The difference between bz2and .gz is that the former has a higher compression ratio than the latter, and the latter takes less time than the former. In other words, after a file is compressed, the file ".bz2" is smaller than the file ".gz", but the file ".bz2" is smaller at the cost of more time. Compressing an instance: compressing a 599M folder workspace

Both .bz2and .gzare the format of the compressed file under linux, which includes the. zip and. rar files under Windows.

The difference between .bz2and .gz is that the former has a higher compression ratio than the latter, and the latter takes less time than the former. In other words, after a file is compressed, the file ".bz2" is smaller than the file ".gz", but the file ".bz2" is smaller at the cost of more time.

Compressing an instance: compressing a 599M folder workspace

Bz2 file

Time tar-jcvf j.tar.bz2 workspace/

340 M 56.8%

Real 13m20. 975 s

User 11m13. 872 s

Sys 0m5. 985 s

Gz file

Time tar-zcvf z.tar.gz workspace/

348 M 58.1%

Real 2m10. 305 s

User 0m54. 228 s

Sys 0m7. 399 s

Conclusion: After compression, the. bz2 file is 8 MB smaller than the. gz file, but it takes more than 6 times the latter time. Of course, the compression ratio and time are related to the format and size of the compressed file. Therefore, this example does not indicate that it is more cost-effective to use gz than to use bz2, but at least it can be proved that bz2 is more compressed than gz, and gz is less time-consuming than bz2.

Related Article

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.