Linux-unzip解压命令的安装与使用
unzip 解压命令的使用
- 首先查看 unzip 的版本号是多少,具体的操作命令如下所示。
leolei@leifenglin:~$ unzip --version
Command 'unzip' not found, but can be installed with:
sudo apt install unzip
屏幕输出信息如上所示,该虚拟机未安装 unzip,并提示安装 unzip 的命令。
 同时可用以下命令查看已安装的软件版本,具体的操作如下所示。
leolei@leifenglin:~$ sudo apt list unzip
Listing... Done
unzip/bionic-updates,bionic-security,now 6.0-21ubuntu1.2 amd64 [installed]
N: There is 1 additional version. Please use the '-a' switch to see it
- 若未检测到 unzip 的版本,则安装unzip,具体的操作命令如下所示。
sudo apt install unzip
卸载软件的命令如下所示。
leolei@leifenglin:~$ sudo apt remove unzip
- 再次检测 unzip 的版本信息,若显示版本号,则证明 unzip 安装成功,可以用于解压 zip 格式的压缩文件。
leolei@leifenglin:~$ unzip --version
caution:  both -n and -o specified; ignoring -o
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.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 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 的版本信息,还有 unzip 的具体使用方法。
 4. 解压zip压缩文件,本文解压的 zip 文件是 spider.zip,具体的操作方法如下所示。
unzip /media/sf_vmvare/spider.zip
这里的解压文件可以使用任意的 zip 文件,但是需要先将 zip 文件放入共享文件夹中,在进行解压。设置共享文件夹的方法可以参考网址:https://blog.csdn.net/2301_77987130/article/details/153210246?spm=1011.2415.3001.5331。
 至此,unzip 的安装与使用就结束了。
