Article Title: learning field: differences between .bz2and .gz files under linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
. Bz2 and. Gz is the format of compressed files in linux, a bit similar to that in windows. Zip and. Rarfile.
. Bz2 and. The difference between gz and gz is that the former has a higher compression ratio than the latter, and the latter takes less time than the former. That is to say, the same file is compressed ,. Bz2 file ratio. The gz file is smaller,. The small size of the bz2 file is 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 ,. Bz2 file only. The gz file is 8 Mb smaller, 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.