0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux][command] ファイル圧縮・解凍・標準出力_gzip, bzip2, xz, gunzip, bunzip, zcat, bzcat, xzcat

Last updated at Posted at 2025-02-01

圧縮効率と処理時間

圧縮率
低 <-----------------> 高
処理時間
短 <-----------------> 長
gzip       bzip2       xz

圧縮

gzip, bzip2, xzコマンド

$ gzip [オプション] [ファイル名]
$ bzip2 [オプション] [ファイル名]
$ xz [オプション] [ファイル名]
オプション 由来 説明
default - ファイルを .gz, .bz2, .xz形式で圧縮する
-d decompress (解凍) - ファイルを解凍する
-k keep (保持) - 圧縮・解凍時に元のファイルを保持する
-c copy to stdout (標準出力) - 圧縮結果を標準出力に書き出す
- 圧縮後も元のファイルを保持する
-l list (一覧表示) - ファイル内の元のファイル情報(サイズや圧縮率)を表示する
-f force (強制) - 既存のファイルがあっても強制的に処理を実行する

解凍

gunzip, bunzip, unxzコマンド

$ gunzip [ファイル名]
オプション 由来 説明
default GNU unzip - ファイルを解凍する
- .gz 拡張子のついたファイルを元の状態に戻す
-c stdout (標準出力) - 解凍結果を標準出力に表示する(ファイルには書き込まない)
-f force (強制) - 既存のファイルがあっても強制的に解凍する
-l list (一覧表示) - .gz ファイル内の元のファイル情報(サイズや圧縮率)を表示する
-t test (テスト) - .gz ファイルが正常に解凍できるかをチェックする
-v verbose (詳細表示) - 解凍時に詳細な情報を表示する
-h または --help help (ヘルプ) - コマンドの使い方を表示する

標準出力

zcat, bzcat, xzcatコマンド

$ zcat [圧縮ファイル名]
オプション 由来 説明
default zip + concatenate - .gz 形式で圧縮されたファイルを解凍せずに中身を標準出力に表示する
- cat コマンドのように使えるが、圧縮ファイルに対応

Ping-t

gzip

bzip

xz

zcat

xzcat

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?