@blackwang
2016-04-14T23:42:24.000000Z
字数 934
阅读 1383
Linux
打包
gzip filename
压缩(会删除源文件)gzip -9 filename
表示以最高的压缩率压缩文件gzip -d filename.gz
或者gunzip filename.gz
。即gzip -d
等价于gunzip
bzip2 -c filename > filename.bz2
bzcat filename.bz2
查看压缩文件的内容,实质是解压之后进行cat这三个的命令基本上时一样的,记住一个即可
zip test.zip test # 压缩test
zip -r test.zip test1.md text2 # 递归压缩test1.md文件和test2目录到test.zip文件
unzip test.zip -d /tmp # 解压缩文件到指定目录
tar -tJf 1.tar.xz
tar -cvf test.tar test text1.txt # 把test目录和text文件打包,不压缩
tar -zcvf test.tar.gz test # 打包后用gzip压缩
tar -jcvf test.tar.bz2 test # 打包后用bzip2压缩
tar -xvf test.tar
tar -xvf test.tar.gz
tar -xjvf test.tar.bz2