zoukankan      html  css  js  c++  java
  • Linux压缩命令

    zip命令类似于Windows系统中的winzip压缩程序

    基本语法

    zip [选项] 压缩包名 源文件或源目录列表

    选项说明

    1 -r:递归压缩目录,及将指定目录下的所有文件以及子目录全部压缩。
    2 -m:将文件压缩之后,删除原始文件,相当于把文件移到压缩文件中。
    3 -v:显示详细的压缩过程信息。
    4 -q:在压缩的时候不显示命令的执行过程。
    5 -压缩级别:压缩级别是从1~9的数字,-1代表压缩速度更快,-9代表压缩效果更好。
    6 -u:更新压缩文件,即往压缩文件中添加新文件。

    使用举例:

    [root@localhost home]# ls
    hello  hello-hard  hello-soft  test  test-soft
    [root@localhost home]# zip hello.zip hello hello-hard
      adding: hello (deflated 99%)
      adding: hello-hard (deflated 99%)
    [root@localhost home]# ls
    hello  hello-hard  hello-soft  hello.zip  test  test-soft
    [root@localhost home]# zip test.zip test test-soft
      adding: test/ (stored 0%)
      adding: test-soft/ (stored 0%)
    [root@localhost home]# ls
    hello  hello-hard  hello-soft  hello.zip  test  test-soft  test.zip
    [root@localhost home]#

    unzip命令可以查看和解压缩zip文件

    基本语法

     unzip [选项] 压缩包名

    选项说明

    1 -d 目录名:将压缩文件解压到指定目录下。
    2 -n:解压时并不覆盖已经存在的文件。
    3 -o:解压时覆盖已经存在的文件,并且无需用户确认。
    4 -v:查看压缩文件的详细信息,包括压缩文件中包含的文件大小、文件名以及压缩比等,但并不做解压操作。
    5 -t:测试压缩文件有无损坏,但并不解压。
    6 -x 文件列表:解压文件,但不包含文件列表中指定的文件。

    使用举例

    [root@localhost home]# ls
    hello.zip  test.zip
    [root@localhost home]# unzip -v hello.zip
    Archive:  hello.zip
     Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
    --------  ------  ------- ---- ---------- ----- --------  ----
       10240  Defl:N       99  99% 07-11-2019 01:28 dda39bf9  hello
       10240  Defl:N       99  99% 07-11-2019 01:28 dda39bf9  hello-hard
    --------          -------  ---                            -------
       20480              198  99%                            2 files
    [root@localhost home]# unzip hello.zip
    Archive:  hello.zip
      inflating: hello
      inflating: hello-hard
    [root@localhost home]# ls
    hello  hello-hard  hello.zip  test.zip
    [root@localhost home]# unzip -d zip test.zip
    Archive:  test.zip
       creating: zip/test/
       creating: zip/test-soft/
    [root@localhost home]# ls
    hello  hello-hard  hello.zip  test.zip  zip
    [root@localhost home]# ls zip
    test  test-soft
    [root@localhost home]#
  • 相关阅读:
    poj 1067||hdu 1527 取石子游戏(博弈论,Wythoff Game)
    CGAffineTransform属性
    自定义UITabBarController
    UISwitch用法:
    UIButton常见属性和方法
    xcode添加背景音乐/音效
    使用cocoaPods加载框架的具体步骤:
    UILabel
    NSString -- UILabel中字体有多种颜色,字符串自动计算高度/换行
    xcode 修改类名 变量名
  • 原文地址:https://www.cnblogs.com/bashliuhe/p/14133077.html
Copyright © 2011-2022 走看看