bzip2

>Usage

bzip2 is a command-line utility for compressing files using the Burrows-Wheeler Block Sorting compression algorithm, which provides better compression rates than gzip.

>Synopsis

bzip2 [option] file

>Options

-z

compress: this option will simply compress the specified file in bzip2 format, saving it by default with .bz2 suffix

Example 1:

Dots

-zsh

bzip2 -z file1.txt


the file file1.txt will be compressed into a .bz2 format

-k

keep original: this option will create a compressed .bz2 version of the file without modifying the original one

Example 2:

Dots

-zsh

bzip2 -k file1.txt


this creates a compressed version of file1.txt without modifying the original

-d

decompress: this option is used to decompress .bz2 file, after decompression the .bz2 will no longer exists.

Example 3:

Dots

-zsh

bzip2 -d file.txt.bz2


this command decompress file.txt.bz2

-v

verbose: this option will display additional information about the compression or decompression process. This includes showing the name of each file being processed and information about the compression ratio.

Example 4:

Dots

-zsh

bzip2 -v file1.txt


This command compresses file1.txt into file1.txt.bz2 and displays information about the file

-f

force: used to force the compression or decompression process, allowing bzip2 to overwrite existing files without asking for confirmation

-t

test integrity: This option is used to test the integrity of a compressed .bz2 file without decompressing it. If the file is valid it will generate no output.

Example 5:

Dots

-zsh

bzip2 -t file.txt.bz2


check the integrity of file.txt

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Oliviero Vescovo