試験運用中なLinux備忘録・旧記事

はてなダイアリーで公開していた2007年5月-2015年3月の記事を保存しています。

雑多な圧縮ツールについて(前半)

ここでは幾つかの圧縮ツール(マイナーなものも含む)を扱う。詳しくは扱わないため、コマンドのヘルプを貼り付けている。

pbzip2

マルチスレッド版bzip2。ファイル1つを圧縮/伸長し、マルチコア環境などで高い性能を発揮する。しかし、圧縮率がより高く伸長がbzip2より高速なXZ Utilsでもマルチスレッドには対応しているため、bzip2形式を選択する理由のある場合でのみ役に立つ。

Usage: pbzip2 [-1 .. -9] [-b#cdfhklp#qrtVz] <filename> <filename2> <filenameN>
 -b#      : where # is the file block size in 100k (default 9 = 900k)
 -c       : output to standard out (stdout)
 -d       : decompress file
 -f       : force, overwrite existing output file
 -h       : print this help message
 -k       : keep input file, don't delete
 -l       : load average determines max number processors to use
 -p#      : where # is the number of processors (default: autodetect [1])
 -q       : quiet mode (default)
 -r       : read entire input file into RAM and split between processors
 -t       : test compressed file integrity
 -v       : verbose mode
 -V       : display version info for pbzip2 then exit
 -z       : compress file (default)
 -1 .. -9 : set BWT block size to 100k .. 900k (default 900k)

Example: pbzip2 -b15vk myfile.tar
Example: pbzip2 -p4 -r -5 myfile.tar second*.txt
Example: tar cf myfile.tar.bz2 --use-compress-prog=pbzip2 dir_to_compress/
Example: pbzip2 -d myfile.tar.bz2

lzop

指定したそれぞれのファイルを圧縮/伸長する(圧縮後の拡張子は「.lzo」)。-Uオプションを付けない場合、元のファイルは消えない。
圧縮率を犠牲にして高速な圧縮/伸長処理を実現している。とは言え、圧縮率の指定は9段階で行える。

Usage: lzop [-dxlthIVL19] [-qvcfFnNPkUp] [-o file] [-S suffix] [file..]

Commands:
  -1     compress faster                   -9    compress better
  -d     decompress                        -x    extract (same as -dPp)
  -l     list compressed file              -I    display system information
  -t     test compressed file              -V    display version number
  -h     give this help                    -L    display software license
Options:
  -q     be quiet                          -v       be verbose
  -c     write on standard output          -oFILE   write output to `FILE'
  -p     write output to current dir       -pDIR    write to path `DIR'
  -f     force overwrite of output files
  -n     do not restore the original file name (default)
  -N     restore the original file name
  -P     restore or save the original path and file name
  -S.suf use suffix .suf on compressed files
  -U     delete input files after successful operation (like gzip and bzip2)
  file.. files to (de)compress. If none given, try standard input.

lzf

指定したそれぞれのファイルを圧縮/伸長する(圧縮後の拡張子は「.lzf」)。圧縮/伸長が非常に高速とされる。

usage: lzf [-dufhvb] [file ...]

-c   compress
-d   decompress
-f   force overwrite of output file
-h   give this help
-v   verbose mode
-b # set blocksize

lzip

指定したそれぞれのファイルを圧縮/伸長する(圧縮後の拡張子は「.lz」)。LZMAアルゴリズムによる高い圧縮率が特長。圧縮は非常に遅い。
XZ Utilsと比べてマイナーで、無理にこちらを使用することはない。

Lzip - A data compressor based on the LZMA algorithm.

Usage: lzip [options] [files]
Options:
  -h, --help                 display this help and exit
  -V, --version              output version information and exit
  -b, --member-size=<n>      set approximate size in bytes of file members
  -c, --stdout               send output to standard output
  -d, --decompress           force decompression
  -f, --force                overwrite existing output files
  -k, --keep                 keep (don't delete) input files
  -m, --match-length=<n>     set match length limit in bytes [64]
  -o, --output=<file>        if reading stdin, place the output into <file>
  -q, --quiet                suppress all messages
  -s, --dictionary-size=<n>  set dictionary size limit in bytes [8MiB]
  -S, --volume-size=<n>      set volume size limit in bytes
  -t, --test                 test compressed file integrity
  -v, --verbose              be verbose (a 2nd -v gives more)
  -z, --compress             force compression
  -1 .. -9                   set compression level [default 6]
      --fast                 alias for -1
      --best                 alias for -9
If no file names are given, lzip compresses or decompresses
from standard input to standard output.
Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...

(「雑多な圧縮ツールについて(後半)」に続く)

関連記事:

使用したバージョン:

  • lzop 1.02rc1
  • pbzip2 1.0.5
  • lzf 3.4
  • lzip 1.4