• Linux命令:unzip


    语法:

    unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]

     

    默认行为将zip文件中的内容全部解压缩到当前目录下。

    举例,unzip    a.zip 

     

    选项 全称 含义 举例
    -d exdir extract directory 解压到-d指定的目录。省略,解压到${PWD}。exdir不存在,自动创建。 unzip taget.zip -d specific_dir
    -P password password 直接在命令给出解压密码,不等提示。  
    -n never 不覆盖已有文件  
    -f  fresh 覆盖原有文件  
    -o overwrite 直接覆盖,不提示是否覆盖。  
    -u update 已有的,覆盖;没有的,新建。  
    -l list 不解压查看zip包内文件

    unzip -l target.zip

    Archive: scripts_b9.zip
    Length Date Time Name
    --------- ---------- ----- ----
    5561 11-29-2018 14:32 buildImage.sh
    5506 11-29-2018 20:25 common.sh
    18519 11-29-2018 14:37 prepare3rdparty.sh
    7807 11-30-2018 10:05 pushArtifactory.sh
    --------- -------
    37393 4 files

    -t test 检查压缩文件是否正确 unzip -t scripts_b9.zip

    Archive: scripts_b9.zip
    testing: buildImage.sh OK
    testing: common.sh OK
    testing: prepare3rdparty.sh OK
    testing: pushArtifactory.sh OK
    No errors detected in compressed data of scripts_b9.zip.

     -z   显示压缩包注释  
     -Z    <=> zipinfo 命令  
    -j   不处理压缩文件中原有的目录路径  
    -C   压缩文件中的文件名称区分大小写  
     -L   将压缩文件中的全部文件名改为小写  
     -s   将文件名中的空格转换下划线  
    -X   解压缩时保留文件原来的UID/GID  
    -q quite 执行时不显示任何信息  
    -v    执行是时显示详细的信息  
    -c    将解压缩的结果显示到屏幕上,并对字符做适当的转换  
    -p   与-c参数类似,会将解压缩的结果显示到屏幕上,但不会执行任何的转换  
    -a   对文本文件进行必要的字符转换  
    -b   不要对文本文件进行字符转换  
    -x   <表达式> 处理里排除压缩包中的指定文件  
    -M   将输出结果送到more程序处理  

            

    本篇文章出自“国民时代”,转载请注明转载出处。
  • 相关阅读:
    ios中strong和weak的解释理解
    leetcode: Remove Duplicates from Sorted Array II [基本功]
    leetcode : Sort Colors
    leetcode : Search a 2D Matrix
    leetcode : Set Matrix Zeroes [技巧 follow up 逐步优化]
    leetcode : edit distance[hard][经典动态规划]
    leetcode : Climbing Stairs
    leetcode : Add Bianry 基本功 字符转整数
    leetcode : Plus One 基本功
    leetcode : Minimum Path Sum
  • 原文地址:https://www.cnblogs.com/ChinaGo/p/10156280.html
Copyright © 2020-2023  润新知