执行unzip --h
可以查看全部unzip的用法
UnZip 6.00 of 20 April , by Info-ZIP. Maintained by C. Spieler. Sendbug reports using http://www.info-/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 exdirmodifiers:-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 archivesSee "unzip -hh" or unzip.txt for more help. Examples:unzip data1 -x joe => extract all files except joe from zipfile data1.zipunzip -p foo | more => send contents of foo.zip via pipe into program moreunzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
用法unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
-Z 是 ZipInfo模式 解压的时候可以不加,加上后会查看压缩包信息-opts[modifiers] 是选择解压模式 常用的有 -q :静默模式,解压时候不会出现详细解压过程-d :解压到指定路径-t : 测试压缩文件是否完整-l :查看压缩文件的内容-v :查看解压信息 file[.zip] 是指zip文件的路径list 是指要解压哪些文件,不添加默认是全部解压-x xlist 指定不要解压xlist中的文件-d exdir是指定解压后所存储的目录 默认是存放在压缩文件同名的目录下
常用用法:
解压文件到当前目录
unzip temp.zip
解压temp.zip到 /tmp/目录
unzip -d /tmp/ temp.zip