Bzip2 is an open source data compression algorithm first released in 1996. It offers better file compression than older algorithms such as LZW and Deflate, but is slower as a trade off. Bzip2 is purely a file compressor. It does not have built-in archive facilities, but you can use bzip2 with an archive tool such as tar to compress multiple files. A bzip2 package is available from the Ubuntu package repository, for easy installation on Ubuntu Linux using the apt tool.
Log in to the remote Ubuntu server through SSH, or open a terminal window if you are running the Ubuntu desktop.
Video of the Day
Type "sudo apt-get update" at the terminal prompt to update the local package list with the latest data from the repository. Enter your password when requested by the sudo command.
Type "sudo apt-get install bzip2" to download and install the bzip2 package from the Ubuntu package repository. The required files are small, so installation is quick to complete.
Type "bzip2 -c filename > compressed.bz2" to compress a file named "filename" into the compressed file "compressed.bz2."
Type "bunzip2 compressed.bz2" to decompress the file named "compressed.bz2." The decompressed file has the same name as the compressed file without the ".bz2" extension.