Create .bz2 File in Linux

Last updated on Dec 28, 2019 in Linux

Bzip2 is a compression method and utility program in Linux. You can compress single and multiple files with it. This tutorial is about to zip a single or multiple files. To compress an entire folder, it is best to do with tar: Create .tar.bz2 File in Linux.

Let’s assume that your file is name myfile.txt. In Linux terminal, type:

$ bzip2 -z myfile.bz2 myfile.txt

z stands for compression. This will create a bz2 file myfile.bz2 in the same folder.

You can also add multiple files to the same bz2 file:

$ bzip2 -z myfile.bz2 myfile.txt another.txt another2.txt