如何查看Debian/Ubuntu Linux是否安装了某个软件包?
列出系统上的所有已安装的软件包:
# dpkg -l
是否安装了hello软件包
# dpkg -l hello Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/Name Version Architecture Description +++-=================-=============-=============-======================================== ii hello 2.9-2+deb8u1 amd64 example package based on GNU hello
如果我们不知道完整的软件包名称,可以使用通配符 *
# dpkg -l 'h*' Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/Name Version Architecture Description +++-=================-=============-=============-======================================== ii hello 2.9-2+deb8u1 amd64 example package based on GNU hello un hello-debhelper (no description available) un hello-traditional (no description available) un hoogle (no description available) un hostapd (no description available) ii hostname 3.15 amd64 utility to set/show the host name or dom un hurd (no description available)
可以看到还列出了卸载的UN
软件包。
要值列出已安装的包,我们可以将输出结果进行grep过滤
# dpkg -l 'h*' | grep ^ii ii hello 2.9-2+deb8u1 amd64 example package based on GNU hello ii hostname 3.15 amd64 utility to set/show the host name or domain name
还有一种方法是使用-s选项
# dpkg -s hello
日期:2020-07-07 20:56:26 来源:oir作者:oir