command zip/unzip

zip/unzip 用来压缩和解压缩文件。

  1. 压缩 a.log b.log
$touch {a..e}.log
$ls
a.log b.log c.log d.log e.log

$zip test.zip a.log b.log 
  adding: a.log (stored 0%)
  adding: b.log (stored 0%)

$ls
a.log  b.log  c.log  d.log  e.log  test.zip
  1. 在test.zip里追加 c.log d.log
$zip test.zip c.log d.log
  adding: c.log (stored 0%)
  adding: d.log (stored 0%)

  1. 查看test.zip里的文件
$unzip -l test.zip
Archive:  test.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  08-26-2021 23:02   a.log
        0  08-26-2021 23:02   b.log
        0  08-26-2021 23:02   c.log
        0  08-26-2021 23:02   d.log
---------                     -------
        0                     4 files

  1. 从test.zip里删除a.log
$unzip -d test.zip a.log
deleting: a.log

  1. 压缩 a.log b.log c.log d.log e.log成 my.zip并删除原始文件
$zip -m my.zip a.log b.log c.log d.log e.log
  adding: a.log (stored 0%)
  adding: b.log (stored 0%)
  adding: c.log (stored 0%)
  adding: d.log (stored 0%)
  adding: e.log (stored 0%)


上一篇:springBoot基本配置


下一篇:如何安装Python3.8版本的TensorFlow?