LINUX 操作系统命令
压缩解压
ZIP
zip用于压缩文件
unzip用于解压文件
语法
zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$][-b <工作目录>][-ll][-n <字尾字符串>][-t <日期时间>][-<压缩效率>][压缩文件][文件…][-i <范本样式>][-x <范本样式>]
路径/home/test
参数及示例
-r 递归处理,将指定目录下的所有文件和子目录一并处理。
zip -r test test
zip -r test.zip test
zip -r test.zip *
-q 不显示指令执行过程。
zip -rq test test
zip -r -q test test
zip -rq test.zip test
zip -rq test.zip *
-d 从压缩文件内删除指定的文件。
zip -rq test.zip *
zip -d test.zip a.zip
zip -d test.zip test/doc1.txt
zip -d test.zip test/doc2.txt
zip -d test.zip test/*
zipinfo显示压缩包中内容
zipinfo指令可得知zip压缩文件的详细信息。
zipinfo test.zip
zipinfo -1 test.zip #只列出文件名
-P 指定压缩文件密码
zip -P 123 -r test.zip *
unzip解压文件
unzip为.zip压缩文件的解压缩程序。
语法
unzip [-cflptuvz][-agCjLMnoqsVX][-P <密码>][.zip文件][文件][-d <目录>][-x <文件>] 或 unzip [-Z]
-P<密码> 使用zip的密码选项。
unzip -P 123 test.zip
-q 执行时不显示任何信息。
unzip -P 123 -q test.zip
-v 是显示压缩文件详细的信息。
unzip -v test.zip
-l 显示压缩文件内所包含的文件
unzip -l test.zip
-d<目录> 指定文件解压缩后所要存储的目录。
unzip test.zip -d ../