Linux Compress & Uncompress, Package & Unpackage
时间:2020-06-16 20:25:00
收藏:0
阅读:56
Common Compress Formation
.zip .gz .bz2 .tar .tar.gz .tar.gz2
zip & unzip (both compress and package but not recommended in linux)
// zip [option] descName srcFile/srcName
// -r means path
zip test.zip abc.html
zip test2.zip abc.html abcd.html
// unzip [option] compressedFile
// -d means path
unzip aaa.zip
gzip (.gz "compress but not package")
// compress
gzip -c abc.html > abc.gz // if you just use "gzip abc.html" then the original file will gone
// uncompress
gzip -d abc.html
bzip2 (.bz2 "compress but not package")
// compress
bzip2 -k abc.html // if you just use "bzip2 abc.html" then the original file will gone
// uncompress
bzip2 -d abc.html
tar (.tar "package but not compress")
// tar [option] [-f packageName.tar] srcFile/srcDirectory
// -c package -v verbose
//package
tar -cvf abc.tar abc.html abcd.html bcd.html
//unpackage
tar -xvf abc.tar
tar (.tar.gz & .tar.bz2 "compress and package")
/*-z compress and uncompress .tar.gz file */
/*-j compress and uncompress .tar.bz2 file */
// compress and package of .tar.gz
tar -zcvf abc.tar.gz abc.html abcd.html bcd.html // output : abc.tar.gz
//unpackage and uncompress of .tar.gz
tar -zxvf abc.tar.gz
// compress and package of .tar.bz2
tar -jcvf abc.tar.bz2 abc.html abcd.html bcd.html // output : abc.tar.bz2
//unpackage and uncompress of .tar.bz2
tar -jxvf abc.tar.bz2
评论(0)