| Extension | Note | compress command | decompress command |
|---|---|---|---|
| .bz2 | bzip2 | bunzip2 | |
| .gz | GNU zip | gzip | gunzip |
| .tgz | gzip-ed tar file | gtar -zcf <file> | gtar -zxf <file> |
| .Z | UNIX compress | compress | uncompress |
To tar something up and compress it at the same time:
To decompress and untar a file at the same time:
zcat <file>.Z gzcat <file>.Z (yes, gzcat and gunzip also work for .Z files) gzcat <file>.gz (note: gzcat is equivalent to "gzip -cd") bzcat <file>.bz2 (note: bzcat is equivalent to "bzip2 -cd")It is often a good idea to pipe the output into a pager like more or less.
gzip -t <files>.gz bzip2 -t <files>.bz2