Session and utilities

The bzip2 command

Compresses files with the bzip2 algorithm (.bz2), which usually packs more than gzip at the cost of speed.

Syntax

bzip2 [-d] [-k] archivo

Most useful options

-dDecompresses
-kKeeps the original
-9Maximum compression

Copy-ready examples

$ printf 'texto\n' > f.txt && bzip2 -k f.txt && lsCompress with bzip2

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • It is slower than gzip and less used today; for general use, gzip or xz.

Related commands

FAQ

bzip2 or gzip?

bzip2 compresses more but takes longer; gzip is faster and standard.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course