列出Ubuntu上已安装的软件包
时间:2020-01-09 10:42:31 来源:igfitidea点击:
列出Apt安装的软件包
要使用apt命令列出所有已安装的软件包,我们使用带有installed标志的list命令。该标志指示易于仅返回已安装的软件包。如果没有该标志,则apt将生成所有可配置存储库中可用软件包的列表。
sudo apt list --installed
我们应该看到类似于以下的输出。当然,内容取决于我们系统上安装的内容。每行将显示软件包名称,版本和体系结构。
Listing... Done accountsservice/bionic,now 0.6.45-1ubuntu1 amd64 [installed] acl/bionic,now 2.2.52-3build1 amd64 [installed] acpid/bionic,now 1:2.0.28-1ubuntu1 amd64 [installed] adduser/bionic,now 3.116ubuntu1 all [installed] apparmor/bionic-updates,bionic-security,now 2.12-4ubuntu5.1 amd64 [installed] apport/bionic,now 2.20.9-0ubuntu7 all [installed,upgradable to: 2.20.9-0ubuntu7.6] apport-symptoms/bionic,now 0.20 all [installed] apt/bionic,now 1.6.1 amd64 [installed,upgradable to: 1.6.10] apt-transport-https/bionic-updates,now 1.6.10 all [installed] apt-utils/bionic,now 1.6.1 amd64 [installed,upgradable to: 1.6.10] at/bionic,now 3.1.20-3.1ubuntu2 amd64 [installed] aufs-tools/bionic,now 1:4.9+20170918-1ubuntu1 amd64 [installed,automatic] base-files/bionic,now 10.1ubuntu2 amd64 [installed,upgradable to: 10.1ubuntu2.4] base-passwd/bionic,now 3.5.44 amd64 [installed] bash/bionic,now 4.4.18-2ubuntu1 amd64 [installed] bash-completion/bionic,now 1:2.8-1ubuntu1 all [installed] bc/bionic,now 1.07.1-2 amd64 [installed] bcache-tools/bionic,now 1.0.8-2build1 amd64 [installed] bind9-host/bionic-updates,bionic-security,now 1:9.11.3+dfsg-1ubuntu1.7 amd64 [installed] bsdmainutils/bionic,now 11.1.2ubuntu1 amd64 [installed] bsdutils/bionic,now 1:2.31.1-0.4ubuntu3 amd64 [installed,upgradable to: 1:2.31.1-0.4ubuntu3.3] btrfs-progs/bionic,now 4.15.1-1build1 amd64 [installed]
列出Dpkg已安装的软件包
apt的替代方法是使用dpkg。该解决方案不像以前那样直观,但是,它是运行Ubuntu 13.04或者更低版本时唯一可行的解决方案。
dpkg管理器使用get-selections标志列出软件包。不幸的是,仅此标志将不会显示已安装软件包的结果列表。为了生成仅已安装软件包的列表,我们必须将结果通过管道传递到grep,然后将结果反转为仅包括不包含关键字deinstall的项目。
dpkg --get-selections | grep -v deinstall
该命令的输出将类似于以下示例。请注意,它提供的信息数量与使用earler的apt list命令所提供的信息数量不同。
accountsservice install acl install acpid install adduser install apparmor install apport install apport-symptoms install apt install apt-transport-https install apt-utils install at install aufs-tools install base-files install base-passwd install bash install bash-completion install bc install bcache-tools install bind9-host install bsdmainutils install bsdutils install btrfs-progs install btrfs-tools install busybox-initramfs install busybox-static install byobu install bzip2 install ca-certificates install cgroupfs-mount install
有关服务器上安装的软件包的更多信息,可以使用-l或者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.45-1ubuntu1 amd64 query and manipulate user account information ii acl 2.2.52-3build1 amd64 Access control list utilities ii acpid 1:2.0.28-1ubuntu1 amd64 Advanced Configuration and Power Interface event daemon ii adduser 3.116ubuntu1 all add and remove users and groups ii apparmor 2.12-4ubuntu5.1 amd64 user-space parser utility for AppArmor ii apport 2.20.9-0ubuntu7 all automatically generate crash reports for debugging ii apport-symptoms 0.20 all symptom scripts for apport ii apt 1.6.1 amd64 commandline package manager ii apt-transport-https 1.6.10 all transitional package for https support ii apt-utils 1.6.1 amd64 package management related utility programs ii at 3.1.20-3.1ubuntu2 amd64 Delayed job execution and batch processing ii aufs-tools 1:4.9+20170918-1ubuntu1 amd64 Tools to manage aufs filesystems ii base-files 10.1ubuntu2 amd64 Debian base system miscellaneous files ii base-passwd 3.5.44 amd64 Debian base system master password and group files ii bash 4.4.18-2ubuntu1 amd64 GNU Bourne Again SHell ii bash-completion 1:2.8-1ubuntu1 all programmable completion for the bash shell ii bc 1.07.1-2 amd64 GNU bc arbitrary precision calculator language ii bcache-tools 1.0.8-2build1 amd64 bcache userspace tools ii bind9-host 1:9.11.3+dfsg-1ubuntu1.7 amd64 DNS lookup utility (deprecated) ii bsdmainutils 11.1.2ubuntu1 amd64 collection of more utilities from FreeBSD ii bsdutils 1:2.31.1-0.4ubuntu3 amd64 basic utilities from 4.4BSD-Lite ii btrfs-progs 4.15.1-1build1 amd64 Checksumming Copy on Write Filesystem utilities ii btrfs-tools 4.15.1-1build1 amd64 transitional dummy package ii busybox-initramfs 1:1.27.2-2ubuntu3.2 amd64 Standalone shell setup for initramfs ii busybox-static 1:1.27.2-2ubuntu3.2 amd64 Standalone rescue shell with tons of builtin utilities ii byobu 5.125-0ubuntu1 all text window manager, shell multiplexer, integrated DevOps environment ii bzip2 1.0.6-8.1 amd64 high-quality block-sorting file compressor - utilities
上面的列表提供了有关程序包版本,目标体系结构的更有价值的信息,并包括简要说明。