linux 系统下 zip 的加密压缩与解压缩命令

时间:2021-04-23 15:54:27

1、加密压缩

[small@sun shine]# zip  -rP king  java.zip  java
adding: java/ (stored 0%)
adding: java/default/ (stored 0%)
adding: java/default/THIRDPARTYLICENSEREADME-JAVAFX.txt (deflated 77%)
adding: java/default/LICENSE (stored 0%)
adding: java/default/man/ (stored 0%)
adding: java/default/man/ja/ (stored 0%)
adding: java/default/man/ja/man1/ (stored 0%)
adding: java/default/man/ja/man1/rmid.1 (deflated 74%)
adding: java/default/man/ja/man1/unpack200.1 (deflated 62%)
adding: java/default/man/ja/man1/javapackager.1 (deflated 78%)

2、查看详情

[small@sun shine]# unzip  -v  java.zip
Archive:  java.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Stored        0   0% 11-21-2018 10:57 00000000  java/
       0  Stored        0   0% 11-21-2018 10:57 00000000  java/default/
   63933  Defl:N    14836  77% 09-06-2017 02:47 6f4562d9  java/default/THIRDPARTYLICENSEREADME-JAVAFX.txt
      40  Stored       40   0% 09-06-2017 10:29 ee974348  java/default/LICENSE
       0  Stored        0   0% 11-21-2018 10:57 00000000  java/default/man/
       0  Stored        0   0% 11-21-2018 10:57 00000000  java/default/man/ja/
       0  Stored        0   0% 11-21-2018 10:57 00000000  java/default/man/ja/man1/

3、解压缩

[small@sun shine]# unzip java.zip 
Archive:  java.zip
[java.zip] java/default/THIRDPARTYLICENSEREADME-JAVAFX.txt password: 

提示:解压缩需要输入密码

[small@sun shine]# unzip -P king java.zip

注:-r 递归  -v 查看 -P  密码