zoukankan      html  css  js  c++  java
  • unzip 命令使用

      http://blog.sina.com.cn/s/blog_6c9d65a10100nzqf.html

    unzip命令:解压缩文件
    他是解压zip压缩的文件,和zip互逆的一对工具。
     
    命令:
    unzip [选项] zip压缩文件
    -c 解压到标准输出上
    -l 小写的L,显示压缩文件内的文件。
    -z 显示压缩文件的备注文字
     
     
    例:
    1、解压文件
    linux@ubuntu:~/cdy$ unzip c.zip
    Archive:  c.zip
    这是一个测试的压缩文件 .
       creating: c/
      inflating: c/a.out                 
      inflating: c/lib.h                 
      inflating: c/abc.c                 
      inflating: c/read.c                
       creating: c/head/
      inflating: c/head/conf.h           
      inflating: c/main.c                
     extracting: c/a.c                   
      inflating: c/write.c               
      inflating: c/read                  
      inflating: c/cdy     
       
    2、解压文件到指定的目录
    linux@ubuntu:~$ unzip -d cdy snow.zip
    Archive:  snow.zip
       creating: cdy/snow/
      inflating: cdy/snow/snow.xml.in    
       creating: cdy/snow/build/
      inflating: cdy/snow/build/snow_options.lo  
      inflating: cdy/snow/build/snow_options.h  
      inflating: cdy/snow/build/snow.o   
       creating: cdy/snow/build/.libs/
      inflating: cdy/snow/build/.libs/libsnow.lai  
    .....
    加一个参数:-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
    这是一个测试的压缩文件 .
      Length      Date    Time    Name
    ---------  ---------- -----   ----
            0  2011-01-16 15:02   c/
         7630  2011-01-16 15:02   c/a.out
         1255  2011-01-16 14:38   c/lib.h
          109  2011-01-16 13:56   c/abc.c
          610  2011-01-16 14:31   c/read.c
            0  2011-01-16 13:48   c/head/
          593  2011-01-16 13:48   c/head/conf.h
          435  2011-01-16 13:29   c/main.c
           73  2011-01-16 14:55   c/a.c
          527  2011-01-16 14:51   c/write.c
         7542  2011-01-16 14:40   c/read
           90  2011-01-16 15:02   c/cdy
    ---------                     -------
        18864                     12 files
     
    我们也可以用一个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文件解压
  • 相关阅读:
    Hello,Cnblogs,I'm Kxia
    运维
    CRT 操作数据库乱码
    STM32 各引脚功能
    遍历结果集
    更换税控服务器主板后,重新申请注册码
    修改远程桌面端口号
    nginx 设置开机启动
    windows 日志清理批处理 设置到计划任务就可以每天清理日志了
    按关键字查找文件
  • 原文地址:https://www.cnblogs.com/wangkongming/p/4002656.html
Copyright © 2011-2022 走看看