相当于 apt 或 dpkg 中的 Get-WmiObject -Class Win32_Product?

相当于 apt 或 dpkg 中的 Get-WmiObject -Class Win32_Product?

我在 Powershell 中使用以下命令来查看安装了哪些版本的程序。

Get-WmiObject -Class Win32_Product | Select-Object -Property Name, version

Debian/Ubuntu 中apt是否有与此等效的东西?dpkg

答案1

在 Debian 后代系统(Ubuntu 等)上,你可以这样做

dpkg --list

显示通过 apt 系统安装的所有应用程序。

cory@redbarchetta[13:40:26]~$ dpkg --list
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  accountsservice                            0.6.55-0ubuntu12~20.04.4                    amd64        query and manipulate user account informa>
ii  accountsservice-ubuntu-schemas             0.0.7+17.10.20170922-0ubuntu1               all          AccountsService schemas for Ubuntu
ii  acl                                        2.2.53-6                                    amd64        access control list - utilities
ii  acpi-support                               0.143                                       amd64        scripts for handling many ACPI events
ii  acpid                                      1:2.0.32-1ubuntu1                           amd64        Advanced Configuration and Power Interfac>
ii  adduser                                    3.118ubuntu2                                all          add and remove users and groups

答案2

您可以通过 来完成grep-status

安装dctrl-tools

sudo apt install dctrl-tools

然后:

grep-status -sPackage,Version -n "install ok installed"

相关内容