zip 压缩和解压缩
安装
sudo apt-get install zip
压缩参数 [root@izbp1ftjj9sbil4ifuqzsuz wwwroot]# zip Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license. Zip 3.0 (July 5th 2008). Usage: zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list] The default action is to add or replace zipfile entries from list, which can include the special name - to compress standard input. If zipfile and list are omitted, zip compresses stdin to stdout. -f freshen: only changed files -u update: only changed or new files -d delete entries in zipfile -m move into zipfile (delete OS files) -r recurse into directories -j junk (don't record) directory names -0 store only -l convert LF to CR LF (-ll CR LF to LF) -1 compress faster -9 compress better -q quiet operation -v verbose operation/print version info -c add one-line comments -z add zipfile comment -@ read names from stdin -o make zipfile as old as latest entry -x exclude the following names -i include only the following names -F fix zipfile (-FF try harder) -D do not add directory entries -A adjust self-extracting exe -J junk zipfile prefix (unzipsfx) -T test zipfile integrity -X eXclude eXtra file attributes -y store symbolic links as the link instead of the referenced file -e encrypt -n don't compress these suffixes -h2 show more help [root@izbp1ftjj9sbil4ifuqzsuz wwwroot]#
解压参数 [root@izbp1ftjj9sbil4ifuqzsuz wwwroot]# unzip UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send bug reports using http://www.info-zip.org/zip-bug.html; see README for details. Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir] Default action is to extract files in list, except those in xlist, to exdir; file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage). -p extract files to pipe, no messages -l list files (short format) -f freshen existing files, create none -t test compressed archive data -u update files, create if necessary -z display archive comment only -v list verbosely/show version info -T timestamp archive to latest -x exclude files that follow (in xlist) -d extract files into exdir modifiers: -n never overwrite existing files -q quiet mode (-qq => quieter) -o overwrite files WITHOUT prompting -a auto-convert any text files -j junk paths (do not make directories) -aa treat ALL files as text -U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields -C match filenames case-insensitively -L make (some) names lowercase -X restore UID/GID info -V retain VMS version numbers -K keep setuid/setgid/tacky permissions -M pipe through "more" pager -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives -I CHARSET specify a character encoding for UNIX and other archives See "unzip -hh" or unzip.txt for more help. Examples: unzip data1 -x joe => extract all files except joe from zipfile data1.zip unzip -p foo | more => send contents of foo.zip via pipe into program more unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer [root@izbp1ftjj9sbil4ifuqzsuz wwwroot]#
主要参数 -d: 将文件解压到指定目录; -c:将解压缩的结果 -l:显示压缩文件内所包含的文件 -p:与-c参数类似,会将解压缩的结果显示到屏幕上,但不会执行任何的转换 -t:检查压缩文件是否正确 -u:与-f参数类似,但是除了更新现有的文件外,也会将压缩文件中的其它文件解压缩到目录中 -v:执行是时显示详细的信息 -z:仅显示压缩文件的备注文字 -a:对文本文件进行必要的字符转换 -b:不要对文本文件进行字符转换 -C:压缩文件中的文件名称区分大小写 -j:不处理压缩文件中原有的目录路径 -L:将压缩文件中的全部文件名改为小写 -M:将输出结果送到more程序处理 -n:解压缩时不要覆盖原有的文件 -o:不必先询问用户,unzip执行后覆盖原有文件 -P:使用zip的密码选项 -q:执行时不显示任何信息 -s:将文件名中的空白字符转换为底线字符 -V:保留VMS的文件版本信息 -X:解压缩时同时回存文件原来的UID/GID
解压
zip -q -r /var/www/ihuoniao20170504.zip /var/www/ihuoniao.cn
解压
unzip -o -q ihuoniao20170504.zip -d /www/wwwroot/longhewang.com