How to Compress File using bunzip2 command Linux – bunzip2 Compress Command
How to Compress File using bunzip2 command Linux – bunzip2 Compress Command
Log into your Linux Server via SSH as root and do the below steps to compress files using bunzip2
Command to compress the files :
bunzip2 -z Filename
OR
bunzip2 –compress Filename
-z means force compression. Use one of the above commands to compress the files (use either -z or –compress to compress files).
Example is given below :
1.5M file “testfile.txt” is compressed to a small file of size 112K.
1.5M testfile.txt
1.5M total
root@server [/usr/local/src]# bunzip2 –compress testfile.txt
root@server [/usr/local/src]# du -sch testfile.txt.bz2
112K testfile.txt.bz2
112K total
If website backups are saved as .bz2 format it will save lot of disk space.

How to Compress Files Bunzip2 Command
Use “bunzip2 -kz” option is used to preserve the original files while compressing. Without “-k” option the original input files will be compressed in *.bz2 format.
root@server [/usr/local/src]# bunzip2 -kz testfile.txt
root@server [/usr/local/src]# ll
-rw-r–r– 1 root root 1489235 May 11 02:36 testfile.txt
-rw-r–r– 1 root root 112194 May 11 02:36 testfile.txt.bz2