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
Time tar-jcvf j.tar.bz2 workspace/
340 M 56.8%
Real 13m20. 975 s
User 11m13. 872 s
Sys 0m5. 985 s
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.