unzip命令:解压缩文件
(2011-01-17 00:27:20)
标签:
杂谈 |
分类: linux命令 |
unzip命令:解压缩文件
他是解压zip压缩的文件,和zip互逆的一对工具。
命令:
unzip [选项] zip压缩文件
-c 解压到标准输出上
-l 小写的L,显示压缩文件内的文件。
-z 显示压缩文件的备注文字
例:
1、解压文件
linux@ubuntu:~/cdy$ unzip c.zip
Archive: c.zip
这是一个测试的压缩文件 .
2、解压文件到指定的目录
linux@ubuntu:~$ unzip -d cdy snow.zip
Archive: snow.zip
.....
加一个参数:-d 目标位置即可。
3、显示注释内容
linux@ubuntu:~$ zip -z snow.zip #先给snow.zip添加注释
enter new zip file comment (end with .):
这是一个雪花效果,很好看啊
. #这个位置输入.结束。
linux@ubuntu:~$ unzip -z snow.zip
#查看注释
Archive: snow.zip
一个雪花效果,很好看啊
4、显示文件中内容(不解压)
linux@ubuntu:~$ unzip -l c.zip
Archive: c.zip
这是一个测试的压缩文件 .
--------- ---------- -----
----
---------
-------
我们也可以用一个zipinfo命令来显示详细信息:
如:
linux@ubuntu:~$ zipinfo c.zip
Archive: c.zip
Zip file size: 9589 bytes, number of entries: 12
drwxr-xr-x 3.0 unx
0 bx stor
11-Jan-16 15:02 c/
-rwxr-xr-x 3.0 unx
7630 bx defN 11-Jan-16 15:02 c/a.out
-rw-r--r-- 3.0 unx
1255 tx defN 11-Jan-16 14:38 c/lib.h
-rw-r--r-- 3.0 unx
109 tx defN 11-Jan-16 13:56
c/abc.c
-rw-r--r-- 3.0 unx
610 tx defN 11-Jan-16 14:31
c/read.c
drwxr-xr-x 3.0 unx
0 bx stor
11-Jan-16 13:48 c/head/
-rw-r--r-- 3.0 unx
593 tx defN 11-Jan-16 13:48
c/head/conf.h
-rw-r--r-- 3.0 unx
435 tx defN 11-Jan-16 13:29
c/main.c
-rw-r--r-- 3.0 unx
73 tx stor 11-Jan-16 14:55
c/a.c
-rw-r--r-- 3.0 unx
527 tx defN 11-Jan-16 14:51
c/write.c
-rwxr-xr-x 3.0 unx
7542 bx defN 11-Jan-16 14:40 c/read
-rw-r--r-- 3.0 unx
90 bx defN 11-Jan-16 15:02
c/cdy
12 files, 18864 bytes uncompressed, 7828 bytes compressed:
58.5%
注意 :
1、unzip解压必须由zip生成的压缩文件
2、一次只能对一个zip文件解压
前一篇:zip命令:归档压缩文件
后一篇:find命令:文件的查找和定位