如何创建、生成、产生、压缩为tar, tar.gz, tar.bz2,tar.xz ,gz, bz, zip, 7z, rar, etc…)

你可能需要安装下面的软件:
su -c 'yum install unzip zip p7zip rar unrar bzip2 gzip lzma'
可能各个系统命令不一样。ubuntu安装bzip2应该是sudo apt-get install bzip2等等。
那么创建各种压缩格式的命令如下

.tar

tar cvf filename.tar /dir

.tar.gz

tar czvf filename.tar.gz /dir

.tgz

tar cvzf filename.tgz /dir

.tar.gz2

You probably mean .tar.bz2

.tar.bz

tar cjvf filename.tar.bz /dir

.tbz

tar cjvf filename.tbz /dir

.tar.bz2

tar cjvf filename.tar.bz2 /dir

.tar.Z

.Z is an old naming convention which has moved to .gz.  See .tar.gz above.

.tar.xz

tar cvf -  filenames | lzma > filename.tar.xz 

.gz

gzip filename

.gz2

You probably mean .bz2

.bz

bzip filename

.bz2

bzip2 filename

.Z

.Z is an old naming convention which has moved to .gz.  See .gz above.

.xz

lzma filename

.zip

zip -r filename.zip /dir

.7z

7z a -t7z filename.7z /dir

.rar

rar a filename.rar /dir

.dmg

This is a bit more complicated than what I have time for. Looks like somebody has already figured something out.

.dd

Create these image files using:

dd if=inputfile.dd of=outputfile.dd
 
原文:http://www.thelinuxdaily.com/2010/02/createcompressarchive-almost-any-file-in-linux-tar-tar-gz-tar-bz2-gz-bz-zip-7z-rar-etc/
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值