1、zip 加密压缩 -P 参数添加压缩密码 zip -9r -P'123456' yaomaomao.zip yaomaomaoDir 如果无此工具,需要安装下 yum install zip 实例如下: [root@localhost update]# yum install zip 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: ftp.sjtu.edu.cn * extras: ftp.sjtu.edu.cn * updates: ftp.sjtu.edu.cn 正在解决依赖关系 --> 正在检查事务 ---> 软件包 zip.x86_64.0.3.0-11.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ============================================================================================================================================================================================================================================================================== Package 架构 版本 源 大小 ============================================================================================================================================================================================================================================================================== 正在安装: zip x86_64 3.0-11.el7 base 260 k 事务概要 ============================================================================================================================================================================================================================================================================== 安装 1 软件包 总下载量:260 k 安装大小:796 k Is this ok [y/d/N]: y Downloading packages: zip-3.0-11.el7.x86_64.rpm | 260 kB 00:00:10 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : zip-3.0-11.el7.x86_64 1/1 验证中 : zip-3.0-11.el7.x86_64 1/1 已安装: zip.x86_64 0:3.0-11.el7 完毕! 2、unzip 使用密码解压 unzip安装 yum install unzip -y unzip解压 unzip -P'123456' yaomaomao.zip -d yaomaomaoDir 若命令行里不输入参数 -P,则解压时会提示输入密码 3、unzip 覆盖解压 unzip -P'123456' yaomaomao.zip -od yaomaomaoDir -o参数,覆盖解压