yum list installed gives me the output as below.
pam_krb5.i386 2.2.14-22.el5 installed
rpm -qa has the below to say.
Both the commands give me the same number of lines as output. I would go with
rpm -qa list.
Also, from this answer, I see the below piece of information.
there is the program, "rpm", which manipulates specifically the
packages it is asked to manipulate, and there is "yum", which is a
more intelligent management system that can find dependencies and
download .rpm files even if they're not in the system.
So the difference might be
yum resolves the dependencies but
rpm has installed all the dependencies and so it provides a more complete list.
I see the actual difference between
rpm as below.
The most prominent problem with
rpm is a state commonly referred to by most people as dependency hell. This problem occurs with packages that depend on a lot of other packages, some of those packages also depend on a lot of other packages. It is common knowledge that you must install all dependencies for the program to work correctly.
rpm is unable to automatically do this for you. It can only check whether all the required packages are installed prior to installing the needed package. Manually tracking and installing each dependency is a major chore for most people who only want to install a single package initially.
yum is capable of tracking the dependencies of a package and installing them prior to installing the package that the user wanted to install. This simplifies the whole process as you need only know the name of the package that you want to install and not worry whether the required packages have been installed or not. Packages that can’t be found on the system are searched for in the repositories that are available to the system.