TrumanWong

bunzip2

Can decompress compressed files in .bz2 format.

Supplementary instructions

bzip2 can compress and decompress files. This command is similar to the "gzip/gunzip" command and only compresses files. For a directory, only all files in the directory can be compressed. After the compression is completed, a compressed package with the suffix ".bz2" will be generated in the directory. bunzip2 is actually a symbolic link of bzip2, that is, a soft link, so decompression can be achieved through bzip2 -d.

grammar

bunzip2(options)(parameters)

Options

-f or --force: When decompressing, if the output file has the same name as an existing file, the existing file will not be overwritten by default;
-k or --keep: After decompression, the original compressed file will be deleted by default. To preserve compressed files, use this parameter;
-s or --small: Reduce the memory usage during program execution;
-v or --verbose: Display detailed information when decompressing files;
-l, --license, -V or --version: Display version information.

Parameters

.bz2 compressed package: Specify the .bz2 compressed package to be decompressed.

Example

Compress etc.zip, var.zip and backup.zip in the /opt directory, set the compression rate to the highest, and at the same time, do not delete the original files after the compression is completed, and display detailed information of the compression process.

bzip2 -9vk /opt/etc.zip /opt/var.zip /opt/backup.zip

After the compression is completed, the corresponding etc.zip.bz2, var.zip.bz2 and backup.zip.bz2 files will be generated under /opt.

unzip:

bunzip2 -v /opt/etc.zip.bz2