压缩

# gunzip test.txt.gz 
它会将文件解压缩为文件 test.txt,原来的文件则没有了,为了保留原有的文件,我们可以加上 -c 选项并利用 linux 的重定向 

# gzip -c test.txt > /root/test.gz 
这样不但可以将原有的文件保留,而且可以将压缩包放到任何目录中,解压缩也一样 

# gunzip -c /root/test.gz > ./test.txt 


zip 命令: 
# zip test.zip test.txt (tar -zxvf test.tar.gz test/)
它会将 test.txt 文件压缩为 test.zip ,当然也可以指定压缩包的目录,例如 /root/test.zip 

# unzip test.zip 
它会默认将文件解压到当前目录,如果要解压到指定目录,可以加上 -d 选项 

# unzip test.zip -d /root/ 

posted @ 2017-04-24 13:26  白鸟li  阅读(132)  评论(0编辑  收藏  举报