gzip |
|
Compress or expand files (replaces original file with .gz compressed version) |
gzip foo.txt |
| |
-c, --stdout, --to-stdout |
Write output to standard output and keep the original files |
gzip -c foo.txt > foo.txt.gz |
| |
-d, --decompress, --uncompress |
Decompress file (causes gzip to act like gunzip) |
gzip -d foo.txt.gz |
| |
-f, --force |
Force compression even if a compressed version of the original file already exists |
gzip -f foo.txt |
| |
-h, --help |
Display usage information |
gzip -h |
| |
-l, --list |
List compression statistics for each file compressed |
gzip -l foo.txt.gz |
| |
-r, --recursive |
Recursively compress files contained within specified directories |
gzip -r dir |
| |
-t, --test |
Test the integrity of a compressed file |
gzip -tv foo.txt.gz |
| |
-v, --verbose |
Display verbose messages while compressing or testing |
gzip -tv foo.txt.gz |
| |
-number, --fast, --best |
Set compression level from 1 (--fast, fastest/least) to 9 (--best, slowest/most; default 6) |
gzip -9 foo.txt |
gunzip |
|
Restore .gz compressed files to their original, uncompressed form |
gunzip foo.txt |
| |
-c |
Write uncompressed output to standard output and keep original file |
gunzip -c foo.txt \| less |
zcat |
|
Write uncompressed contents of .gz files to standard output (equivalent to gunzip -c) |
zcat foo.txt.gz \| less |
zless |
|
View .gz compressed text files interactively using a pager |
zless foo.txt.gz |
bzip2 |
|
Compress files using a block-sorting algorithm (creates .bz2 files; supports gzip options except -r) |
bzip2 foo.txt |
bunzip2 |
|
Restore .bz2 compressed files to their original, uncompressed form |
bunzip2 foo.txt.bz2 |
bzcat |
|
Write uncompressed contents of .bz2 files to standard output |
bzcat foo.txt.bz2 \| less |
bzip2recover |
|
Attempt to recover data from damaged .bz2 files |
bzip2recover foo.txt.bz2 |
tar |
|
Tape archiving utility for bundling and extracting collections of files and directories |
tar cf playground.tar playground |
| |
c |
Create an archive from a list of files and/or directories (mode) |
tar cf playground.tar playground |
| |
x |
Extract an archive (mode) |
tar xf ../playground.tar |
| |
r |
Append specified pathnames to the end of an archive; creates archive if nonexistent (mode) |
find playground -name 'file-A' -exec tar rf playground.tar '{}' '+' |
| |
t |
List the contents of an archive (mode) |
tar tf playground.tar |
| |
f |
Specify the pathname of the tar archive file (or - for standard input/output) |
tar cf playground.tar playground |
| |
v |
Display verbose file listings during archive operations |
tar tvf playground.tar |
| |
z |
Compress or decompress the archive directly using gzip |
find playground -name 'file-A' \| tar czf playground.tgz -T - |
| |
j |
Compress or decompress the archive directly using bzip2 |
find playground -name 'file-A' \| tar cjf playground.tbz -T - |
| |
--wildcards |
Enable wildcard matching when specifying pathnames to extract |
tar xf ../playground2.tar --wildcards 'home/me/playground/dir-*/file-A' |
| |
-T, --files-from |
Read list of pathnames to archive from a file (or - for standard input) |
find playground -name 'file-A' \| tar cf - --files-from=- \| gzip > playground.tgz |