Linux Compress & Uncompress, Package & Unpackage
Posted nedrain
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Compress & Uncompress, Package & Unpackage相关的知识,希望对你有一定的参考价值。
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
以上是关于Linux Compress & Uncompress, Package & Unpackage的主要内容,如果未能解决你的问题,请参考以下文章