License Part II and Quick start

Using lbzip2 should be straightforward for most of users because it is fully compatible with bzip2. Additionally, lbzip2 usage is very similar to other compressors, like gzip and xz, so users of these programs should have no problems using lbzip2.

There’s a chance that lbzip2 is already installed in your system. You can check this by running:

If lbzip2 is not installed then system shell will print something like “command not found”. Otherwise version of installed lbzip2 will be printed. The latest released version of lbzip2 is 2.5. It’s recommended to use the latest version if possible. If you can’t upgrade lbzip2 installed in your system then you can build and install a local copy.

lbzip2 is shipped with number of operating systems. It is recommended to use packaging management software of your system to install system version of lbzip2. If you can’t or don’t want to do this, you can compile lbzip2 from sources.

This document presents only basic usage of lbzip2. More advanced usage, including all available options, is described in detail in the manual. You are encouraged to see the manual if this document doesn’t give enough information.

File compression

To compress a single file you can simply run:

This command will replace file_name with its compressed form – file_name.bz2. The original file will be deleted upon successful compression. You can keep it by specifying --keep parameter (-k in short):

lbzip2 doesn’t output any logging information during normal operation. Error messages are printed only on failure, but also warnings can be printed in some cases too. More verbose logging can be turned on by specifying --verbose option (-v in short):

lbzip2 doesn’t output any logging information during normal operation. Error messages are printed only on failure, but also warnings can be printed in some cases too. More verbose logging can be turned on by specifying --verbose option (-v in short):

If no file names are given as command line arguments then lbzip2 works in filter mode. This means that lbzip2 will compress or decompress data from standard input to standard output. For example:

To extract all files just skip the files-to-be-extracted part.

The above commands will use lbzip2 only if bzip2 is not installed or tar was configured to work with lbzip2. Otherwise you can pass an additional --use-compress-program option to tar to make it use lbzip2, for example:

lbzip2 works well with pipes, so you can redirect standard streams to a pipe. The following example concatenates several compressed files, sorts them and writes merged output to a single file.

 

Leave a Reply

Your email address will not be published. Required fields are marked *