Bzip2

From Free net encyclopedia

(Difference between revisions)
Revision as of 18:34, 20 April 2006
Unixguy (Talk | contribs)
/* See also */ add [[List of Unix programs]]
Next diff →

Current revision

{{Infobox file format | name = bzip2 | extension = .bz2 | mime = | owner = Julian Seward | creatorcode = Bzp2 | genre = data compression | containerfor = | containedby = | extendedfrom = | extendedto = }} Template:Lowercase bzip2 is a free software/open source data compression algorithm and program developed by Julian Seward. Seward made the first public release of bzip2, version 0.15, in July 1996. The compressor's stability and popularity grew over the next several years, and Seward released version 1.0 in late 2000.

bzip2 compresses most files more effectively than more traditional gzip or ZIP, but is slower. In this manner it is fairly similar to other recent-generation compression algorithms. Unlike other formats such as RAR or ZIP (and similar to gzip), bzip2 is only a data compressor, not an archiver. The program itself has no facilities for multiple files, encryption or archive-splitting, in the UNIX tradition instead relying on separate external utilities such as tar and GnuPG for these tasks.

In most cases, bzip2 is surpassed by 7z and RAR formats in terms of absolute compression efficiency. With the constant effect of Moore's Law making computer time less and less important, compression methods like these have become quite popular. According to the author, bzip2 gets within ten to fifteen percent of the "best" class of compression algorithms currently known (PPM), although it is roughly twice as fast at compression and six times faster at decompression.

bzip2 uses the Burrows-Wheeler transform to convert frequently recurring character sequences into strings of identical letters, and then applies a move-to-front transform and finally Huffman coding. In bzip2 the blocks are all the same size in plaintext, which can be selected by a command-line argument, and are marked in compresstext by an arbitrary bit sequence derived from the decimal representation of pi.

Originally, bzip2's ancestor bzip used arithmetic coding after the blocksort; this was discontinued because of the patent restriction.

In Unix, bzip2 can be used combined with or independently of tar: bzip2 file to compress and bzip2 -d file.bz2 to uncompress (the alias bunzip2 for decompression may also be used).

bzip2's command line flags are mostly the same as in gzip. So, to extract from a bzip2-compressed tar-file you can do this:

bzip2 -cd archivefile.tar.bz2 | tar -xvf -

To create a bzip2-compressed tar-file you can do this:

tar -cv - filenames | bzip2 -9 > archivefile.tar.bz2

GNU tar supports a -j flag, which allows you to make tar.bz2 in one go (this is likely the most common form in which you will find bzip2 files):

tar -cvjf archivefile.tar.bz2 file-list

Decompressing in GNU tar is easy enough:

tar -xvjf archivefile.tar.bz2

See also

External links

de:Bzip2 es:Bzip2 fr:Bzip2 it:Bzip2 nl:Bzip2 ja:Bzip2 pl:BZIP2 tr:Bzip2