Created
July 5, 2016 11:20
-
-
Save HellMagic/b204fd485935b507707058d44d2fc272 to your computer and use it in GitHub Desktop.
简单实用压缩
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar在linux上是常用的打包、压缩、加压缩工具,他的参数很多,折里仅仅列举常用的压缩与解压缩参数 | |
参数: | |
-c :create 建立压缩档案的参数; | |
-x : 解压缩压缩档案的参数; | |
-z : 是否需要用gzip压缩; | |
-v: 压缩的过程中显示档案; | |
-f: 置顶文档名,在f后面立即接文件名,不能再加参数 | |
举例: 一,将整个/home/www/images 目录下的文件全部打包为 /home/www/images.tar | |
[root@xoaocom ~]# tar -cvf /home/www/images.tar /home/www/images ← 仅打包,不压缩 | |
[root@xoaocom ~]# tar -zcvf /home/www/images.tar.gz /home/www/images ← 打包后,以gzip压缩 | |
在参数f后面的压缩文件名是自己取的,习惯上用tar来做,如果加z参数,则以tar.gz 或tgz来代表gzip压缩过的tar file文件 | |
举例: 二,将 /home/www/images.tar.gz 解压到/home/www下面 | |
[root@xoaocom ~]# cd /home/www | |
[root@xoaocom ~]# tar -zxvf /home/images.tar.gz | |
解压到指定的目录 | |
[root@xoaocom ~]# tar -zxvf /home/images.tar.gz -C /specific dir | |
解包到指定的目录 | |
tar xvf filename.tar -C /specific dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment