linux zip/unzip命令



<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">命令名:<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';"> zip</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">功能说明:压缩文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">语  法:<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">zip -AcdDfFghjJKlLmoqrSTuvVwXyz$-ll-t <</span>日 期时间<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">></span>压 缩文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-i <</span>范本样式<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">></span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">补充说明:<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">zip</span>是个使用广泛的压缩程序,文件经它压缩后会另外产生具 有<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">".zip"</span>扩展名 的压缩文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">参  数:</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-A   </span>调 整可执行的自动解压缩文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-b<</span>工作目录<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>指 定暂时存放文件的目录。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-c   </span>替 每个被压缩的文件加上注释。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-d   </span>从 压缩文件内删除指定的文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-D   </span>压 缩文件内不建立目录名称。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-f   </span>此 参数的效果和指定<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">"-u"</span>参 数类似,但不仅更新既有文件,如果某些文件原本不存在于压缩文件内,使用本参数会一并将其加入压缩文件中。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-F   </span>尝 试修复已损坏的压缩文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-g   </span>将 文件压缩后附加在既有的压缩文件之后,而非另行建立新的压缩文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-h   </span>在 线帮助。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-i<</span>范本样式<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>只 压缩符合条件的文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-j   </span>只 保存文件名称及其内容,而不存放任何目录名称。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-J   </span>删 除压缩文件前面不必要的数据。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-k   </span>使 用<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">MS-DOS</span>兼容格 式的文件名称。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-l   </span>压 缩文件时,把<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">LF</span>字符 置换成<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">LF+CR</span>字 符。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-ll   </span>压 缩文件时,把<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">LF+CR</span>字 符置换成<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">LF</span>字符。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-L   </span>显 示版权信息。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-m   </span>将 文件压缩并加入压缩文件后,删除原始文件,即把文件移到压缩文件中。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-n<</span>字尾字符串<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>不 压缩具有特定字尾字符串的文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-o   </span>以 压缩文件内拥有最新更改时间的文件为准,将压缩文件的更改时间设成和该文件相同。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-q   </span>不显 示指令执行过程。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-r   </span>递 归处理,将指定目录下的所有文件和子目录一并处理。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-S   </span>包 含系统和隐藏文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-t<</span>日期时间<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>把 压缩文件的日期设成指定的日期。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-T   </span>检 查备份文件内的每个文件是否正确无误。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-u   </span>更 换较新的文件到压缩文件内。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-v   </span>显 示指令执行过程或显示版本信息。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-V   </span>保 存<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">VMS</span>操作系统的文 件属性。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-w   </span>在 文件名称里假如版本编号,本参数仅在<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">VMS</span>操 作系统下有效。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-x<</span>范本样式<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>压 缩时排除符合条件的文件。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-X   </span>不 保存额外的文件属性。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-y   </span>直 接保存符号连接,而非该连接所指向的文件,本参数仅在<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">UNIX</span>之 类的系统下有效。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-z   </span>替 压缩文件加上注释。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-$   </span>保 存第一个被压缩文件所在磁盘的卷册名称。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-<</span>压缩效率<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>压 缩效率是一个介于<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">1-9</span>的 数值。</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">例子</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">1. </span>压缩<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">test.MYI</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# zip test1.zip test.MYI</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">adding: test.MYI (deflated 42%)</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]#ll</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-rw-r--r-- 1 root    root    1033755 09-24 10:03 test1.zip</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">压缩率为<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">8</span>的</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# zip test2.zip -8 test.MYI</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">adding: test.MYI (deflated 42%)</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]#ll</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-rw-r--r-- 1 root    root    1033451 09-24 10:03 test2.zip</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">2.   </span>将当前目录下的所有文件和文件夹全部压缩成test.zip文件,-r表示递归压缩子目录下所有文件</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# </span>zip -r test.zip ./*</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">打包目录</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# </span>zip test2.zip test2/*</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">3.   </span>删除压缩文件test1.zip中<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">test.MYI</span>文件</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# </span>zip -d test1.zip <span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">test.MYI</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">删除打包文件目录下的文件</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# zip -d </span>test2<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">.zip test2/ln.log</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">deleting: tests/ln.log</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">4.   </span>向压缩文件中test1.zip中添加test.<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';"> MYI</span>文件</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# </span>zip -m test1.zip test.<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';"> MYI</span></p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">5.   </span>压缩文件时排除某个文件</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# </span>zip test3.zip tests/* -x tests/ln.log</p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<p style="margin:10px auto;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"> </p>
<div class="cnt" style="margin:0px;padding:0px;font-family:verdana, 'ms song', 宋体, arial, 微软雅黑, helvetica, sans-serif;line-height:21.6px;"><p style="margin:10px auto;padding:0px;">命令名:<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';"> unzip</span></p>
<p style="margin:10px auto;padding:0px;">功 能说明:解压缩<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">zip</span>文 件</p>
<p style="margin:10px auto;padding:0px;">语  法:<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">unzip -cflptuvz-P <</span>密 码<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">></span>文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[-x <</span>文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>] </span>或<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';"> unzip [-Z]</span></p>
<p style="margin:10px auto;padding:0px;">补充说明:<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">unzip</span>为<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">.zip</span>压缩文件的解压缩程序。</p>
<p style="margin:10px auto;padding:0px;">参  数:</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-c   </span>将 解压缩的结果显示到屏幕上,并对字符做适当的转换。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-f   </span>更 新现有的文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-l   </span>显 示压缩文件内所包含的文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-p   </span>与<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-c</span>参数类似,会将解压缩的结果显示到屏幕上,但不会执行任 何的转换。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-t   </span>检 查压缩文件是否正确。,但不解压。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-u   </span>与<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-f</span>参数类似,但是除了更新现有的文件外,也会将压缩文件中 的其他文件解压缩到目录中。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-v   </span>执 行是时显示详细的信息。或查看压缩文件目录,但不解压。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-z   </span>仅 显示压缩文件的备注文字。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-a   </span>对 文本文件进行必要的字符转换。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-b   </span>不 要对文本文件进行字符转换。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-C   </span>压 缩文件中的文件名称区分大小写。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-j   </span>不 处理压缩文件中原有的目录路径。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-L   </span>将 压缩文件中的全部文件名改为小写。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-M   </span>将 输出结果送到<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">more</span>程 序处理。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-n   </span>解 压缩时不要覆盖原有的文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-o   </span>不 必先询问用户,<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">unzip</span>执 行后覆盖原有文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-P<</span>密码<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>使 用<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">zip</span>的密码选项。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-q   </span>执 行时不显示任何信息。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-s   </span>将 文件名中的空白字符转换为底线字符。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-V   </span>保 留<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">VMS</span>的文件版本信 息。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-X   </span>解 压缩时同时回存文件原来的<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">UID/GID</span>。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[.zip</span>文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">]   </span>指定<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">.zip</span>压缩文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[</span>文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">]   </span>指定 要处理<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">.zip</span>压缩文 件中的哪些文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-d<</span>目录<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>指 定文件解压缩后所要存储的目录。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-x<</span>文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">>   </span>指 定不要处理<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">.zip</span>压 缩文件中的哪些文件。</p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">-Z   unzip -Z</span>等 于执行<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">zipinfo</span>指 令。</p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">1</span>:将压缩文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">text.zip</span>在当前目录下解压缩。</p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# unzip test.zip</span></p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">2</span>:将压缩文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">text.zip</span>在指定目录<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">/tmp</span>下解压缩,如果已有相同的文件存在,要求<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">unzip</span>命令不覆盖原先的文件。</p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# unzip -n test.zip -d /tmp</span></p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">3</span>:查看压缩文件目录,但不解压。</p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# unzip -v test.zip</span></p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;">例<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">4</span>:将压缩文件<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">test.zip</span>在指定目录<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">tmp</span>下解压缩,如果已有相同的文件存在,要求<span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">unzip</span>命令覆盖原先的文件。</p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">[root@mysql test]# unzip -o test.zip -d tmp/</span></p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"> </p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">使用</span></p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">unzip "*.zip"</span></p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">ls *.zip | xargs -n1 unzip</span></p>
<p style="margin:10px auto;padding:0px;"><span style="margin:0px;padding:0px;line-height:18px;font-family:'times new roman';">解压当前目录下的所有zip文件</span></p>
<p style="margin:10px auto;padding:0px;"> </p>
</div>

标签: linux, 压缩解压, zip, unzip

相关文章

评论已关闭