Centos

rpm -qa vs yum list installed:為什麼某些軟體包只能使用 rpm -qa 找到?

  • December 5, 2017

我已經Python 2.7.5安裝在 CentOS 中,想知道為什麼我可以使用rpm -qa而不是yum list installed命令找到它?

[root@CentOS7 centos]# python -V
Python 2.7.5
[root@CentOS7 centos]# 

[root@CentOS7 centos]# rpm -qa | grep python-2.7.5
python-2.7.5-58.el7.x86_64
[root@CentOS7 centos]#

[root@CentOS7 centos]# yum list installed | grep python-2.7.5
[root@CentOS7 centos]# 

我的參考:

http://www.linuxnix.com/list-installed-packages-and-their-details-in-redhatcentosfedore/

當你grepyum list installed你那裡得到的格式與你不同時rpm -qa

看 :

[root@user1 ~]# yum list installed | grep 2.7.5
python.x86_64                          2.7.5-58.el7                    @base    
python-libs.x86_64                     2.7.5-58.el7                    @base  


[root@user1 ~]# rpm -qa | grep 2.7.5
python-libs-2.7.5-58.el7.x86_64
python-2.7.5-58.el7.x86_64

yum list installed在 3 個不同的列中顯示包名稱、版本號和下載它的儲存庫暱稱。

因此,對於yum list installed您只想包名稱或版本號grep **。**你不能grep像你那樣把它們放在一起rpm -qa

[root@user1 ~]# yum list installed | grep python.x86_64
audit-libs-python.x86_64               2.7.6-3.el7                     @base    
dbus-python.x86_64                     1.1.1-9.el7                     installed
libselinux-python.x86_64               2.5-11.el7                      @base    
libsemanage-python.x86_64              2.5-8.el7                       @base    
libxml2-python.x86_64                  2.9.1-6.el7_2.3                 installed
newt-python.x86_64                     0.52.15-4.el7                   installed
policycoreutils-python.x86_64          2.5-17.1.el7                    @base    
python.x86_64                          2.7.5-58.el7                    @base    
rpm-python.x86_64                      4.11.3-25.el7                   @base   

引用自:https://unix.stackexchange.com/questions/402301