如何在 Linux 中列出属于特定组的已安装软件包

前段时间,我们发表了一篇文章,描述了如何 查找具有已安装大小的已安装应用程序 在 Linux 中。 今天,我们将看到如何列出属于特定组的已安装包。 您可能已经知道,所有 Linux 发行版都具有一次安装一组软件包的能力。 这就是我们所说的包组。 说为 example, ‘mate-desktop’ 包组将安装所有与 MATE 桌面环境相关的包。 简而言之,包组是服务于共同目的的包的集合。

这个简短的教程描述了如何列出属于 Linux 中特定组的已安装包。

列出属于 Linux 中特定组的已安装软件包

在测试下面给出的这些命令之前,请确保您已经在 Linux 机器中安装了一些软件包组。

在 Arch Linux 及其衍生产品上:

在 Arch Linux 及其衍生产品如 Antergos、Manjaro Linux 中,以下命令显示已安装的包属于一个 MATE 包组。

$ sudo pacman -Qg mate

样本输出:

mate caja
mate marco
mate mate-backgrounds
mate mate-control-center
mate mate-desktop
mate mate-icon-theme
mate mate-menus
mate mate-notification-daemon
mate mate-panel
mate mate-polkit
mate mate-session-manager
mate mate-settings-daemon
mate mate-themes
mate mate-user-guide

同样,以下命令显示已安装的软件包属于 LXDE 软件包组。

$ sudo pacman -Qg lxde

请注意,上面的命令只会显示一个包组的已安装包。 要列出属于一个组的所有包,请运行:

$ sudo pacman -Sg lxde

有关更多详细信息,请参阅手册页。

$ man pacman

下载免费提示和技巧指南:“Windows 应用程序的 Linux 替代方案”

在基于 RPM 的系统上,如 RHEL、CentOS、 Fedora:

要列出已安装的软件包属于名为“Web Server”的组,请运行以下命令 用户:

# yum groups info "Web Server"

样本输出:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: mirror.vinahost.vn
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net

Group: Web Server
 Group-Id: web-server
 Description: Allows the system to act as a web server, and run Perl and Python web applications.
 Mandatory Packages:
 =httpd
 Default Packages:
 =crypto-utils
 =httpd-manual
 =mod_fcgid
 =mod_ssl
 Optional Packages:
 Pound
 certmonger
 cherokee
 libmemcached
 memcached
 mod_auth_kerb
 mod_auth_mellon
 mod_auth_openidc
 mod_fcgid
 mod_nss
 mod_revocator
 mod_security
 mod_security_crs
 moin
 perl-CGI
 perl-CGI-Session
 plone
 python-memcached
 squid
 zope

正如您在上面的输出中看到的,这些包标有不同的符号。

  • “=” : 软件包已安装并且它是作为软件包组的一部分安装的。
  • ” + “ : 软件包没有安装,但会在下一次 yum 升级或 yum 组升级时安装。
  • “——” : 软件包未安装,也不会作为软件包组的一部分安装。
  • 没有符号 :软件包已安装,但它安装在软件包组之外。 这意味着 百胜集团删除 命令不会删除这些包。

有关更多详细信息,请参阅手册页。

# man yum

在 Debian、Ubuntu 系统上:

在基于 DEB 的系统中,包组被称为“任务”。 任务是预定义的软件集合。

要查看可用任务列表,请运行:

$ tasksel --list-task

样本输出:

u manual Manual package selection
u kubuntu-live Kubuntu live CD
u lubuntu-live Lubuntu live CD
u ubuntu-gnome-live Ubuntu GNOME live CD
u ubuntu-live Ubuntu live CD
u ubuntu-mate-live Ubuntu MATE Live CD
u ubuntustudio-dvd-live Ubuntu Studio live DVD
u ubuntustudio-live Ubuntu Studio live CD
u xubuntu-live Xubuntu live CD
u cloud-image Ubuntu Cloud Image (instance)
u dns-server DNS server
u edubuntu-desktop-gnome Edubuntu desktop
u kubuntu-desktop Kubuntu desktop
u kubuntu-full Kubuntu full
u lamp-server LAMP server
u lubuntu-core Lubuntu minimal installation
u lubuntu-desktop Lubuntu Desktop
u mail-server Mail server
u mythbuntu-backend-master Mythbuntu master backend
u mythbuntu-backend-slave Mythbuntu slave backend
u mythbuntu-desktop Mythbuntu additional roles
u mythbuntu-frontend Mythbuntu frontend
u postgresql-server PostgreSQL database
u samba-server Samba file server
u tomcat-server Tomcat Java server
u ubuntu-desktop Ubuntu desktop
u ubuntu-gnome-desktop Ubuntu GNOME desktop
u ubuntu-mate-cloudtop Ubuntu MATE cloudtop
u ubuntu-mate-core Ubuntu MATE minimal installation
u ubuntu-mate-desktop Ubuntu MATE desktop
u ubuntu-usb Ubuntu desktop USB
u ubuntustudio-audio Audio recording and editing suite
u ubuntustudio-desktop Ubuntu Studio desktop
u ubuntustudio-desktop-core Ubuntu Studio minimal DE installation
u ubuntustudio-font-meta Large selection of font packages
u ubuntustudio-graphics 2D/3D creation and editing suite
u ubuntustudio-photography Photograph touchup and editing suite
u ubuntustudio-publishing Publishing applications
u ubuntustudio-video Video creation and editing suite
u virt-host Virtual Machine host
u xubuntu-core Xubuntu minimal installation
u xubuntu-desktop Xubuntu desktop
i openssh-server OpenSSH server
i server Basic Ubuntu server

在这里,字母 “你”‘一世’ 表示已卸载/未安装和已安装的任务。 正如您在上面的输出中看到的,我有两个已安装的任务,即“openssh-server”和“server”。 现在,让我们回到主题。

列出属于任何包组(即任务)的包,对于 example openssh服务器,运行:

$ aptitude show openssh-server

此命令将列出该任务将安装的软件包。

样本输出:

Package: openssh-server 
State: installed
Automatically installed: no
Multi-Arch: foreign
Version: 1:7.2p2-4ubuntu2.1
Priority: optional
Section: net
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Uncompressed Size: 912 k
Depends: libaudit1 (>= 1:2.2.1), libc6 (>= 2.17), libcomerr2 (>= 1.01),
 libgssapi-krb5-2 (>= 1.12.1+dfsg-2), libkrb5-3 (>= 1.13~alpha1+dfsg),
 libpam0g (>= 0.99.7.1), libselinux1 (>= 1.32), libssl1.0.0 (>= 1.0.2),
 libsystemd0, libwrap0 (>= 7.6-4~), zlib1g (>= 1:1.1.4), debconf (>=
 0.5) | debconf-2.0, init-system-helpers (>= 1.18~), lsb-base (>=
 4.1+Debian11ubuntu7), openssh-client (= 1:7.2p2-4ubuntu2.1),
 libpam-runtime (>= 0.76-14), libpam-modules (>= 0.72-9), adduser (>=
 3.9), dpkg (>= 1.9.0), procps, openssh-sftp-server
Recommends: xauth, ncurses-term, ssh-import-id
Suggests: ssh-askpass, rssh, molly-guard, ufw, monkeysphere
Conflicts: sftp, ssh-socks, ssh2, openssh-server:i386
Replaces: ssh, ssh:i386, ssh-krb5, ssh-krb5:i386
Provides: openssh-server:i386 (= 1:7.2p2-4ubuntu2.1), ssh-server,
 ssh-server:i386
Provided by: openssh-server:i386 (1:7.2p2-4), openssh-server:i386
 (1:7.2p2-4ubuntu2.1)
Description: secure shell (SSH) server, for secure access from remote machines
 This is the portable version of OpenSSH, a free implementation of the Secure
 Shell protocol as specified by the IETF secsh working group. 
[...]

有关更多详细信息,请参阅手册页:

$ man apt

在 SUSE/openSUSE 上:

在 SUSE/openSUSE 发行版中,这组软件称为模式。

要找出哪些包属于某个模式,请使用“if”或“info”,如下所示:

$ zypper if -t pattern <pattern_name>

或者,

$ zypper pattern-info <pattern_name>

说为 example,下面的命令显示包属于一个名为lamp_server的模式。

$ zypper pattern-info lamp_server

有关更多详细信息,请参阅手册页:

$ man zupper

而且,这就是现在的全部。 您现在知道这些包属于一个包组。 我很快就会在这里提供另一个有用的指南。 如果您觉得本指南有用,请在您的社交网络上分享。

干杯!

感谢您的光临!

帮助我们帮助您:

祝你有美好的一天!!