oreilly.comSafari Books Online.Conferences.


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.


bzip2 [options] filenames bunzip2 [options] filenames bzcat [option] filenames bzip2recover filenames

File compression and decompression utility similar to gzip, but uses a different algorithm and encoding method to get better compression. bzip2 replaces each file in filenames with a compressed version of the file and with a .bz2 extension appended. bunzip2 decompresses each file compressed by bzip2 (ignoring other files, except to print a warning). bzcat decompresses all specified files to standard output, and bzip2recover is used to try to recover data from damaged files.

Additional related commands include bzcmp, which compares the contents of bzipped files; bzdiff, which creates diff (difference) files from a pair of bzip files; bzgrep, to search them; and the bzless and bzmore commands, which apply the more and less commands to bzip output, as bzcat does with the cat command. See cat, cmp, diff, and grep for information on how to use those commands.



End of options; treat all subsequent arguments as filenames.


Set block size to dig × 100 KB when compressing, where dig is a single digit from 1 to 9.

-c, --stdout

Compress or decompress to standard output.

-d, --decompress

Force decompression.

-f, --force

Force overwrite of output files. Default is not to overwrite. Also forces breaking of hard links to files.

-k, --keep

Keep input files; don't delete them.

-L, --license, -V, --version

Print license and version information, and exit.

-q, --quiet

Print only critical messages.

--repetitive-fast, --repetitive-best

Obsolete flags, occasionally useful in versions earlier than 0.9.5 (which has an improved sorting algorithm) for providing some control over the algorithm.

-s, --small

Use less memory, at the expense of speed.

-t, --test

Check the integrity of the files, but don't actually compress them.

-v, --verbose

Verbose mode. Show the compression ratio for each file processed. Add more -v's to increase the verbosity.

-z, --compress

Force compression, even if invoked as bunzip2 or bzcat.

-1, --fast

Perform fast compression, creating a relatively large file. This has no effect on decompression. Higher numbers, up to 9, create progressively better-compressed files. See -9, --best.

-9, --best

Get the best possible compression, although it will take longer.


To produce two files: fileone.txt.bz2 and filetwo.ppt.bz2, while deleting the two original files:

bzip2 fileone.tzt filetwo.ppt

To produce a single compressed file, output.bz2, which can be decompressed to reconstitute the original fileone.txt and filetwo.txt:

bzip2 -c fileone.txt filetwo.txt > output.bz2

The tar command, combined with the -j or --bzip2 option, creates the output file nutshell.tar.bz2:

tar -cjf nutshell.tar.bz2 /home/username/nutshell

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: