If you are on a RPM-based Linux platform (such as Redhat, CentOS, Fedora, ArchLinux, Scientific Linux, etc.), here are two ways to determine the list of packages installed.
Using yum:
yum list installed
Using rpm:
rpm -qa
You can also easily get a count of the installed packages by piping the output to wc:
yum list installed | wc -l
rpm -qa | wc -l
Hello,
yum list installed | wc -l
doesn’t always work as the output of yum list installed is pretty printed. One package may be printed on multiple lines if needed.
@Feriaman
You’re right, that’s why i get different package count from yum and rpm:
[root@centos7 ~]# yum list installed | wc -l
294
[root@centos7 ~]# rpm -qa | wc -l
292