Compressing with ‘bzip2’ and ‘bunzip2’
Both are Linux-based commands which perform file compression and decompression with better performance than gzip
.
The bzip2
compression according to Wikipedia uses the Burrows-Wheeler algorithm, which is self-contained with input and output buffers that remain of the same size. The operating limit for this stage is 900Kb so is relatively focused on files over that file directories.
Both bzip2
and bunzip
will by default not override existing files. Of course, you can force the command to do it.
bzip2 file.txt
By applying the bzip2 command to a file.txt, will result in a file.txt.bz2 (extension)
You can also undo all the processes using the bunzip2
command, or with the same bzip2
command, but the -d
flag. Like this:
bunzip2 file.txt.bz2
bzip2 -d file.txt.bz2
Another great feature of this bzip2
command is the ability to perform a file integration check, this can be done with the -t
flag.
bzip2 -t file.txt