Thursday, December 31, 2009

TAR,GZIP,BZIP2,ZIP

TAR,GZIP,BZIP2,ZIP
Features:
Compression utilities (gzip, bzip2, zip)
File rollers (the ability to represent many files as one)
GZIP:
Includes:
gzip - compresses/decompresses files
gunzip - decompresses gzip files

Tasks:
1. compress '1million.txt' file using gzip
gzip -c 1million.txt > 1million.txt.gz

Note: gzip auto-dumps to STDOUT, by default

gzip -l 1million.txt.gz - returns status information
• gunzip 1million.txt.gz - dumps to file, and removes compressed version
• gzip -d 1million.txt.gz
• zcat 1million.txt.gz - dumps the contents to STDOUT
• less 1million.txt.gzip - dumps the contents of gzip files to STDOUT

Bzip2:

1. bzip2 -c 1million.txt > 1million.txt.bz2
Note: Bzip2 tends to outperform gzip on larger files
2. bunzip2 1million.txt.bz2
3. bzip2 -d 1million.txt.bz2
4. bzcat 1million.txt.bz2 - dumps contents to STDOUT
5. less 1million.txt.bz2 - also dumps the contents to STDOUT
Zip & unzip:
1. zip filename.zip path/ - general usage
2. zip 1million.txt.zip 1million.txt
Note: zip differs slight from gzip and bzip2 in that the destination file (resultant zip file) is specified before the source
3. unzip 1million.txt.zip


Tar & Gzip/Bzip2:
1. tar -cvf filename.tar path/ - creates a non-compressed archive
2. tar -cvf 1million.txt.tar 1million.txt
Note: tar, requires a small overhead for itself in each file
3. tar -czvf 1million.txt.tar.gz 1million.txt - creates, tar/gzip document
4. tar -cjvf 1million.txt.tar.bz2 1million.txt - creates, tar/bzip2 document
5. tar -tzvf
6. tar -cjvf 1million.txt.tar.bz2 1million.txt testRH5/- creates, tar/bzip2
document for the text file and 'testRH5' directory tree

No comments:

Post a Comment