zip压缩工具 tar打包打包并压缩

zip压缩工具

zip支持压缩目录。并且源文件不删除。
先yum安装zip


·
zip压缩文件:zip+压缩后的文件名+源文件名
如压缩1.txt
zip 1.txt.zip 1.txt

·
-r:压缩目录,如下图将1.txt和yang压缩并取名为y.zip

·
zip有一个特点,压缩后不会删除原文件,我们还是可以看到原文件的

·
unzip:解压(如果提示未找到命令就安装unzip包)

·
因为zip 的特点是不会删除原文件,所以我们解压的时候会提示是否覆盖,A是全部覆盖

·
-d:指定解压到哪里,如下图(unzip后面先跟压缩包,再跟-d,然后跟指定的目录)

·
unzip -l查看压缩文件列表

·
·
·
·
·
tar打包
tar打包可以加快传输大数量的零散文件(往同一个目录打包两次文件第二次的包会覆盖第一次的包,不会提示)
打包目录方法如下图(c代表创建、v代表可视化、f后面加打包完成后的名字)
tar -cvf后面加打包完成后的名字以及源目录的名字
tar -cvf yang.tar yang

<br/>解包方法如下图:(如果该目录存在包里的文件,那么解包出来的文件会覆盖该目录下相同的文件,不会提示)<br/>![](http://i2.51cto.com/images/blog/201804/17/90babab678a98b417a06912c36729eb3.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)<br/>
tar -tf查看包里的文件列表

<br/>--exclude:过滤掉文件或目录不打包,如下图打包的同时过滤掉yang目录<br/>![](http://i2.51cto.com/images/blog/201804/17/a389c965575835ef5ae3d424c201ff3a.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)<br/>
过滤掉所有txt文件如下图

<br/>
<br/>
`
打包并压缩

打包并用gzip压缩:

·
打包并用bzip2压缩:

·
打包并用xz压缩:

·
解包并解压缩只要将上述三条命令里的c改成x
解压到指定的目录方法如下使用-C
·
[[email protected] ~]# tar -zxvf /home/images.tar.gz -C /specific dir
tar -tf查看打包并压缩的文件列表

原文地址:http://blog.51cto.com/13658403/2104642

时间: 2024-08-30 09:10:47

zip压缩工具 tar打包打包并压缩的相关文章

zip压缩工具 tar打包 打包并压缩

6.5 zip压缩工具 6.6 tar打包 6.7 打包并压缩 zip压缩工具 xz,bzip2,gzip都不支持压缩目录 zip可以压缩目录 压缩文件 zip  2.txt.zip  2.txt [[email protected] ~]# zip 2.txt.zip 2.txt adding: 2.txt (deflated 99%) [[email protected] ~]# du -sh * 108K 2.txt 4.0K 2.txt.zip 压缩目录+文件 zip  -r  test

zip压缩工具 tar打包并压缩

一.zip压缩工具zip支持压缩目录#zip filename.zip filename //使用zip命令压缩filename文件#zip -r aaa.zip aaa //压缩目录需要加-r ,使用zip命令压缩aaa目录#unzip //解压缩命令#unzip aaa.zip -d bbb/ //-d 指定aaa.zip文件解压到bbb目录下#unzip -l aaa.zip //查看aaa.zip的文件列表,不能查看内容 二.tar打包工具#tar -cvf aaa.tar aaa/ /

6.5 zip压缩工具 6.6 tar打包 6.7 打包并压缩

- 6.5 zip压缩工具 - 6.6 tar打包 - 6.7 打包并压缩 #  6.5 zip压缩工具 - zip压缩工具可以压缩目录 - 压缩目录需要用zip -r ``` [[email protected] d6z]# ls 1.txt.bz2  2.txt  2.txt.zip  3.txt  4.txt  aminglinux [[email protected] d6z]# zip -r aming.zip 3.txt aminglinux adding: 3.txt (defla

zip压缩工具、tar打包、打包并压缩

一.zip压缩工具 zip支持压缩目录和文件.zip压缩的文件后缀名为.zip.yum install -y zip  #安装zip压缩工具 zip命令压缩文件:zip 压缩包名 被压缩的文件名.后缀名以.zip结尾. zip命令压缩目录:zip -r 压缩包名 被压缩的目录(文件).后缀名以.zip结尾. zip压缩与bzip2.xz.gzip压缩的不同之处在于,zip压缩后原文件还在,其它三种压缩后原文件就不在了. unzip解压缩:unzip 压缩包. 当解压的目录下存在相同名字的文件,系

6.5 zip压缩工具;6.6 tar打包;6.7 打包并压缩

6.5 zip压缩工具 yum安装zip压缩工具: [[email protected] ~]# yum install -y zip 1. zip压缩文件:zip 压缩文件名 原文件 [[email protected] ~]# zip hao.txt.zip hao.txt 2. zip压缩目录:zip -r   压缩目录名 原目录 [[email protected] ~]# zip -r mulu1.zip mulu yum安装zip解压工具: [[email protected] ~]

二十、zip压缩工具、tar打包、打包并压缩

一.zip压缩工具 在Windows和Linux中都常用.可以压缩目录和文件,压缩目录时,需要指定目录下的文件.压缩后源文件不删除.示例: # zip 1.txt.zip 1.txt (压缩文件,先目标文件名,再源文件名) adding: 1.txt (deflated 64%) 压缩目录时需要加上-r选项,如下: # zip -r 1.txt.zip 1/ adding: 1/ (stored 0%) adding: 1/11/ (stored 0%) adding: 1/11/111/ (s

zip压缩工具,tar打包,打包并压缩

zip 压缩工具 支持压缩目录 安装:yum install -y zip [[email protected] ddd]# tree . ├── 111 │?? ├── 1.txt │?? └── 222 │?? └── 333 │?? └── 444 ├── 1.txt └── 2.txt.bz2.xz 4 directories, 3 files [[email protected] ddd]# du -sh 111/ 2.0M 111/ [[email protected] ddd]#

Linux CentOS 7 中打包压缩工具gzip、bzip2、xz、zip、tar

一. 压缩打包介绍 常见压缩文件 windows .rar  .zip  .7z linux: .rar .zip .gz .bz2 .xz .tar.gz .tar.bz2  .tar.xz 二. gzip压缩工具 gzip压缩文件: gzip 只能压缩文件不能压缩目录.**gzip 1.txt 压缩完成原文件删除**生成1.txt文件: find /etc/ -type f -name  "*.conf" -exec cat {} >> /tmp/fxq/1.txt \

linux的zip、tar压缩打包工具介绍

zip压缩工具: 1.安装zip命令工具 yum install -y zip 2.zip压缩工具既可以压缩文件也可以压缩目录,而且压缩的时候不会源文件删除,示例如下: [[email protected] d6z]# ls                 //查看目录下的文件 1.txt.bz2  2.txt  3.txt  4.txt  aminglinux [[email protected] d6z]# zip 2.txt.zip 2.txt         //使用zip压缩2.txt