你可能需要安装下面的软件:
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 likesomebody 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/
转载原文:http://blog.csdn.net/caimo/article/details/7909000