包管理器,dpkg-query 不可用

包管理器,dpkg-query 不可用

为什么dpkg -p packageName某些包(例如adduserdash显示其信息,而其他包(例如nodejs,git,firefox)却显示dpkg-query: package name is not available

答案1

手动的解释一下 ;-) man dpkg-query

-p, --print-avail [package-name...]
       Display details about packages, as found in
       /var/lib/dpkg/available.  If no package-name is specified, it will
       display all package entries in the available database (since dpkg
       1.19.1).  When multiple package-name are listed, the requested
       available entries are separated by an empty line, with the same
       order as specified on the argument list.

       Users of APT-based frontends should use `apt show package-name`
       instead as the available file is only kept up-to-date when using
       dselect.

最后一句话解释了这一点:使用apt show package-name

例子:

$ apt show firefox
Package: firefox
Version: 87.0+build3-0ubuntu4
Priority: optional
Section: web
Origin: Ubuntu

$ apt show git
Package: git
Version: 1:2.30.2-1ubuntu1
Priority: optional
Section: vcs
Origin: Ubuntu

ETC。

相关内容