The syntax of the bzip2 command is similar to gzip, but it uses a different compression algorithm and creates a smaller-sized compressed file, at the price of more time taken for compression.
The following table lists the bzip2 compression command and its description with some examples:
Command |
Description |
bzip2 * |
Compresses all files in the current directory and each compressed file is renamed with the .bz2 extension |
bunzip2 *.bz2 or bzip2 -d *.bz2 |
Decompresses all the files with the .bz2 extension in the current directory |
The examples of the bzip2 and bunzip2 commands are shown in the following screenshot: