bunzip2

bzip2 とは、BZIP2形式で圧縮されたファイルを展開(解凍)するLinux/Unixコマンドである。bunzip2 と bzip2 は実質的に同じプログラムであり、bzip2 コマンドで解凍したり、bunzip2 コマンドで圧縮することもできる。

概要

bunzip2 [-fkvsVL] [filename]...
bunzip2 [-h|--help]

引数

展開(解凍)するファイルのパスを引数に指定する。

$ bunzip2 example.tar.bz2

複数のファイルを引数に指定できる。

$ bunzip2 file1.bz2 file2.bz2 file3.bz2

オプション

以下に示すオプションを bunzip2 コマンドに指定できる。

-f
出力ファイルの上書きを強制する。デフォルトの動作では、出力ファイルと同名のファイルが既に存在する場合は、ファイルを出力しない。 (POSIX)
$ bunzip2 example.txt.bz2
bunzip2: Output file example.txt already exists.
$ bunzip2 -f example.txt.bz2
--force
出力ファイルの上書きを強制する。デフォルトの動作では、出力ファイルと同名のファイルが既に存在する場合は、ファイルを出力しない。 (GNU)
$ bunzip2 example.txt.bz2
bunzip2: Output file example.txt already exists.
$ bunzip2 --force example.txt.bz2
-k
圧縮ファイルを残しておく。デフォルの動作では、ファイルを解凍したら、圧縮ファイルは削除される。 (POSIX)
$ bunzip2 -k example.txt.bz2
--keep
圧縮ファイルを残しておく。デフォルの動作では、ファイルを解凍したら、圧縮ファイルは削除される。 (GNU)
$ bunzip2 --keep example.txt.bz2
-s
圧縮、解凍、およびテストのためのメモリ使用量を削減する。サイズが大きなファイルでも 2300 KB のメモリで解凍できる。ただし、通常の約半分の速度になる。 (POSIX)
$ bunzip2 -s example.txt.bz2
--small
圧縮、解凍、およびテストのためのメモリ使用量を削減する。サイズが大きなファイルでも 2300 KB のメモリで解凍できる。ただし、通常の約半分の速度になる。 (GNU)
$ bunzip2 --small example.txt.bz2
-v
冗長モード(各ファイルの圧縮率を表示する) (POSIX)
$ bunzip2 -v example.txt.bz2
--verbose
冗長モード(各ファイルの圧縮率を表示する) (GNU)
$ bunzip2 --verbose example.txt.bz2
-h
ヘルプ・メッセージを表示して、コマンドを終了する。 (POSIX)
$ bunzip2 -h
bzip2, a block-sorting file compressor.  Version 1.0.8, 13-Jul-2019.

   usage: bzip2 [flags and input files in any order]

   -h --help           print this message
   -d --decompress     force decompression
   -z --compress       force compression
   -k --keep           keep (don't delete) input files
   -f --force          overwrite existing output files
   -t --test           test compressed file integrity
   -c --stdout         output to standard out
   -q --quiet          suppress noncritical error messages
   -v --verbose        be verbose (a 2nd -v gives more)
   -L --license        display software version & license
   -V --version        display software version & license
   -s --small          use less memory (at most 2500k)
   -1 .. -9            set block size to 100k .. 900k
   --fast              alias for -1
   --best              alias for -9

   If invoked as `bzip2', default action is to compress.
              as `bunzip2',  default action is to decompress.
              as `bzcat', default action is to decompress to stdout.

   If no file names are given, bzip2 compresses or decompresses
   from standard input to standard output.  You can combine
   short flags, so `-v -4' means the same as -v4 or -4v, &c.
--help
ヘルプ・メッセージを表示して、コマンドを終了する。 (GNU)
$ bunzip2 --help
-L
ソフトウェアのバージョン、ライセンス条件および使用条件を表示する。 (POSIX)
$ bunzip2 -L
--license
ソフトウェアのバージョン、ライセンス条件および使用条件を表示する。 (GNU)
$ bunzip2 --license
-V
ソフトウェアのバージョン、ライセンス条件および使用条件を表示する。 (POSIX)
$ bunzip2 -V
--version
ソフトウェアのバージョン、ライセンス条件および使用条件を表示する。 (GNU)
$ bunzip2 --version

Microsoft Windows

Microsoft WindowsでBZIP2形式のファイルを展開(解凍)するには、以下に示す方法がある。

エクスプローラーで展開する

Windows 11の比較的新しいバージョン(24H2以降)では、エクスプローラーが多くの圧縮形式をネイティブ対応するようになり、.bz2.tar.bz2 ファイルの展開にも対応している。エクスプローラーからファイルを右クリックして 「すべて展開」 を選択する。

tarコマンドで展開する

Microsoft Windows 10 または Microsoft Windows 11tar コマンドを利用して.bz2.tar.bz2 ファイルを展開できる。PowerShellを起動して、tar.exe コマンドを実行する。

C:\> tar -xf exampel.tar.bz2

アプリケーション・ソフトウェアで展開する。

以下に示すアプリケーション・ソフトウェアを使って.bz2 ファイルを展開できる。アプリケーション・ソフトウェアは、.tar.bz2 を一気に展開(解凍)できるものが多い。

関連記事