liang lei liang lei - 4 months ago 12
Linux Question

Yum and RPM show that the number of installed packages is different

[root@study ~]# rpm -qa | wc -l
777

[root@study ~]# yum list installed | wc -l
1054


i want to know why different,shoud i get correct number of installed packages?

Answer

Example, CentOS 7 :

$ rpm -qa | wc -l
1733

$ yum list installed | wc -l
1757

Reason : wc will also count the 24 "extra yum lines" ... please check with :

$ yum list installed >> yum-list-installed.txt

$ rpm -qa >> list__rpm-qa.txt

... and watch the result in the text files : Use an editor with line numbers enabled.

Note : The above commands are unprivileged user commands. No reason to use root.

Comments