linux CentOS8 查看包(package)信息

8.2.2. LISTING PACKAGES

yum list 和其它相关的命令提供packages, package groups, repositories 相关信息。
通过拓展一个或多个glob expressions 作为yum's list commands 的参数,可以实现对结果的过滤。 Glob expression 是普通字符串,它包含一个或多个通配符(*,可以多次匹配任意字符; ,可以匹配任意一个字符)。

Note :
当将 glob expressions 作为参数传递给 yum命令时,需要注意 glob expressions 表达式的转义,否则 Bash shell 会将这些表达式当作 pathname expansions, 进而会将当前路径下所有匹配 glob 的文件传递给 yum. 为了glob expressions能够按照我们的意图传递给yum,有两种方式可供选择:

+  通过在通配符前添加反斜杠字符实现转义
+  将整个`glob expression`  用双引号或单引号引起来
1.1 yum list glob_expression :

能够和glob expressions匹配的并且已经安装的和available packages 信息将会list :

#example: 使用 glob expressions将`ABRT add-ons`和`plug-ins` 列出:
#注释:`ABRT add-ons`和`plug-ins`  packages 以`abrt-addon- ` 或者 `abrt-plugin- `开头 
[arthur@localhost ~]$ yum list abrt-addon\* abrt-plugin\*
CentOS-8 - AppStream                                                                                                  4.2 MB/s | 8.8 MB     00:02    
CentOS-8 - Base                                                                                                       4.4 MB/s | 6.5 MB     00:01    
CentOS-8 - Extras                                                                                                      14 kB/s |  10 kB     00:00    
CentOS-8 - PowerTools                                                                                                 2.5 MB/s | 2.3 MB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                474 kB/s | 939 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64                                                                        4.6 MB/s |  10 MB     00:02    
Available Packages
abrt-addon-ccpp.x86_64                                                          2.10.9-20.el8                                                AppStream
abrt-addon-coredump-helper.x86_64                                               2.10.9-20.el8                                                AppStream
abrt-addon-kerneloops.x86_64                                                    2.10.9-20.el8                                                AppStream
abrt-addon-pstoreoops.x86_64                                                    2.10.9-20.el8                                                AppStream
abrt-addon-vmcore.x86_64                                                        2.10.9-20.el8                                                AppStream
abrt-addon-xorg.x86_64                                                          2.10.9-20.el8                                                AppStream
abrt-plugin-machine-id.x86_64                                                   2.10.9-20.el8                                                AppStream
abrt-plugin-sosreport.x86_64                                                    2.10.9-20.el8                                                AppStream
1.2 yum list all

将所有installed and available packages list :

[arthur@localhost ~]$ yum list all 
Last metadata expiration check: 0:10:39 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
###Installed Packages
Last metadata expiration check: 0:10:39 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
Installed Packages
GConf2.x86_64                                                                3.2.6-22.el8                                                  @AppStream 
ModemManager.x86_64                                                          1.10.4-1.el8                                                  @anaconda  
ModemManager-glib.x86_64                                                     1.10.4-1.el8                                                  @anaconda  
NetworkManager.x86_64                                                        1:1.20.0-3.el8                                                @anaconda  
NetworkManager-adsl.x86_64                                                   1:1.20.0-3.el8                                                @anaconda  
NetworkManager-bluetooth.x86_64                                              1:1.20.0-3.el8                                                @anaconda  
NetworkManager-libnm.x86_64                                                  1:1.20.0-3.el8                                                @anaconda  
NetworkManager-libreswan.x86_64                                              1.2.10-4.el8                                                  @AppStream 
NetworkManager-team.x86_64                                                   1:1.20.0-3.el8                                                @anaconda  
NetworkManager-tui.x86_64                                                    1:1.20.0-3.el8                                                @anaconda  
NetworkManager-wifi.x86_64                                                   1:1.20.0-3.el8                                                @anaconda  
NetworkManager-wwan.x86_64                                                   1:1.20.0-3.el8                                                @anaconda  
PackageKit.x86_64                                                            1.1.12-3.el8                                                  @AppStream 
PackageKit-command-not-found.x86_64                                          1.1.12-3.el8                                                  @AppStream 
PackageKit-glib.x86_64                                                       1.1.12-3.el8                                                  @AppStream 
PackageKit-gstreamer-plugin.x86_64                                           1.1.12-3.el8                                                  @AppStream 
PackageKit-gtk3-module.x86_64                                                1.1.12-3.el8                                                  @AppStream 
R.x86_64                                                                     4.0.3-1.el8                                                   @epel      
R-core.x86_64                                                                4.0.3-1.el8                                                   @epel      
R-core-devel.x86_64                                                          4.0.3-1.el8                                                   @epel      


###Available Packages
3proxy.x86_64                                                                0.8.13-1.el8                                                  epel       
AusweisApp2.x86_64                                                           1.22.2-3.el8                                                  epel       
AusweisApp2-data.noarch                                                      1.22.2-3.el8                                                  epel       
AusweisApp2-doc.noarch                                                       1.22.2-3.el8                                                  epel       
BackupPC.x86_64                                                              4.4.0-1.el8                                                   epel       
BackupPC-XS.x86_64                                                           0.62-1.el8                                                    epel       
BibTool.x86_64                                                               2.68-1.el8                                                    epel       
CCfits.x86_64                                                                2.5-14.el8                                                    epel       
CCfits-devel.x86_64                                                          2.5-14.el8                                                    epel       
CCfits-doc.noarch                                                            2.5-14.el8                                                    epel       
CFR.noarch                                                                   0.151-4.el8                                                   epel       
CFR-javadoc.noarch                                                           0.151-4.el8                                                   epel       
CGSI-gSOAP.x86_64                                                            1.3.11-7.el8                                                  epel       
CGSI-gSOAP-devel.x86_64                                                      1.3.11-7.el8                                                  epel       
CUnit.i686                                                                   2.1.3-17.el8                                                  AppStream  
1.3 yum list installed

list 所有系统已安装的 packages , 输出中最右边的列列出了从其中检索包的存储库。

#列出以`krb`开头,后随一个字符和一个连字符的所有 installed packages 
[arthur@localhost ~]$ yum list "krb?-*"
Last metadata expiration check: 0:34:44 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
Installed Packages
krb5-devel.x86_64                                                            1.18.2-5.el8                                                      @BaseOS
krb5-libs.x86_64                                                             1.18.2-5.el8                                                      @BaseOS
Available Packages
krb5-devel.i686                                                              1.18.2-8.el8                                                      BaseOS 
krb5-devel.x86_64                                                            1.18.2-8.el8                                                      BaseOS 
krb5-libs.i686                                                               1.18.2-8.el8                                                      BaseOS 
krb5-libs.x86_64                                                             1.18.2-8.el8                                                      BaseOS 
krb5-pkinit.i686                                                             1.18.2-8.el8                                                      BaseOS 
krb5-pkinit.x86_64                                                           1.18.2-8.el8                                                      BaseOS 
krb5-server.i686                                                             1.18.2-8.el8                                                      BaseOS 
krb5-server.x86_64                                                           1.18.2-8.el8                                                      BaseOS 
krb5-server-ldap.i686                                                        1.18.2-8.el8                                                      BaseOS 
krb5-server-ldap.x86_64                                                      1.18.2-8.el8                                                      BaseOS 
krb5-workstation.x86_64                                                      1.18.2-8.el8                                                      BaseOS 
[arthur@localhost ~]$ 
1.4 yum list available

all enabled repositories 中的available packages 列出:

#列出名称中包含“gstreamer”和“plugin”的所有可用包
arthur@localhost ~]$ yum list available "*gstreamer*plugin*"
Last metadata expiration check: 0:42:50 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
###Available Packages
PackageKit-gstreamer-plugin.x86_64                                                 1.1.12-6.el8                                             AppStream 
gstreamer-plugin-crystalhd.x86_64                                                  3.10.0-22.el8                                            epel      
gstreamer1-plugins-bad-free.i686                                                   1.16.1-1.el8                                             AppStream 
gstreamer1-plugins-bad-free.x86_64                                                 1.16.1-1.el8                                             AppStream 
gstreamer1-plugins-bad-free-devel.i686                                             1.16.1-1.el8                                             PowerTools
gstreamer1-plugins-bad-free-devel.x86_64                                           1.16.1-1.el8                                             PowerTools
gstreamer1-plugins-base.i686                                                       1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-base.x86_64                                                     1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-base-devel.i686                                                 1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-base-devel.x86_64                                               1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good.i686                                                       1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good.x86_64                                                     1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good-gtk.i686                                                   1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good-gtk.x86_64                                                 1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-ugly-free.i686                                                  1.16.1-1.el8                                             AppStream 
gstreamer1-plugins-ugly-free.x86_64                                                1.16.1-1.el8                                             AppStream 
[arthur@localhost ~]$ yum list available gstreamer\*plugin\*
Last metadata expiration check: 0:43:42 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
###Available Packages
gstreamer-plugin-crystalhd.x86_64                                                  3.10.0-22.el8                                            epel      
gstreamer1-plugins-bad-free.i686                                                   1.16.1-1.el8                                             AppStream 
gstreamer1-plugins-bad-free.x86_64                                                 1.16.1-1.el8                                             AppStream 
gstreamer1-plugins-bad-free-devel.i686                                             1.16.1-1.el8                                             PowerTools
gstreamer1-plugins-bad-free-devel.x86_64                                           1.16.1-1.el8                                             PowerTools
gstreamer1-plugins-base.i686                                                       1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-base.x86_64                                                     1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-base-devel.i686                                                 1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-base-devel.x86_64                                               1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good.i686                                                       1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good.x86_64                                                     1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good-gtk.i686                                                   1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-good-gtk.x86_64                                                 1.16.1-2.el8                                             AppStream 
gstreamer1-plugins-ugly-free.i686                                                  1.16.1-1.el8                                             AppStream 
gstreamer1-plugins-ugly-free.x86_64                                                1.16.1-1.el8                                             AppStream 
[arthur@localhost ~]$ yum list available gstreamer\*plugin
Last metadata expiration check: 0:43:58 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
Error: No matching Packages to list
[arthur@localhost ~]$ 
1.5 yum group list

列出所有的package groups.

[arthur@localhost ~]$ yum group list
Last metadata expiration check: 0:48:56 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
###Available Environment Groups:
   Server with GUI
   Server
   Minimal Install
   KDE Plasma Workspaces
   Virtualization Host
   Custom Operating System
###Installed Environment Groups:
   Workstation
###Installed Groups:
   Container Management
   RPM Development Tools
   Development Tools
   Graphical Administration Tools
   Headless Management
   Legacy UNIX Compatibility
   Network Servers
   Scientific Support
   Security Tools
   Smart Card Support
   System Tools
###Available Groups:
   .NET Core Development
   Fedora Packager
   Xfce
[arthur@localhost ~]$ 
1.6 yum repolist

列出已经启用的存储库的存储库ID、名称和提供的包的数量。

[arthur@localhost ~]$ yum repolist
Last metadata expiration check: 0:48:15 ago on Mon 13 Sep 2021 09:21:32 AM EDT.
repo id                                            repo name                                                                                    status
AppStream                                          CentOS-8 - AppStream                                                                         5,802
BaseOS                                             CentOS-8 - Base                                                                              2,076
PowerTools                                         CentOS-8 - PowerTools                                                                        1,632
*epel                                              Extra Packages for Enterprise Linux 8 - x86_64                                               7,760
*epel-modular                                      Extra Packages for Enterprise Linux Modular 8 - x86_64                                           0
extras                                             CentOS-8 - Extras                                                                               37

reference:

8.2.2. Listing Packages - Red Hat Customer Portal website

上一篇:Linux Shell编程基础


下一篇:OAF_文件系列6_实现OAF导出XML文件javax.xml.parsers/transformer(案例)