Basic Linux Commands III - Gzip , Tar, Bzip2
### Gzip , Tar, Bzip2 ###
gzip
a. gzip -c 12thousnd.txt > 12thousnd.txt.gz
b. gunzip 12thousnd.txt.gz -dumps to file and delete the compressed version
c. gzip -c 12thousnd.txt.gz
d. zcat 12thousnd.txt.gz dumps to STDOUT
zcat 12thousnd.txt.gz > test12th.txt
bzip2
a. bzip2 -c 12thousnd.txt >12thousnd.txt.bz2
can have more compression
b. bunzip 12thousnd.txt.bz2
c. bzcat 12thoousnd.txt.bz2
zip & unzip
a. zip filename.zip path_to_source_file/
ex: zip 12thousnd.txt.zip 12thousnd.txt
(differ from gzip ,bzip2)
b. unzip 12thousnd.txt.zip
tar and gzip/bzip2
a. tar -cvf filename.tar path_for_source/
need extra overhead(memory)
b. tar -czvf filename.tar.gz path_for source/
(creates filename.tar.gz)
c. tar -cjvf filename.tar.bz2 path_for source/
(creates filename.tar.bz2)
d. tar -cjvf 12thousnd.txt.tar.bz2 12thousnd.txt testRH/
(baackup all in testRH also into the file)
Comments
Post a Comment