List installed packages with `yum` on CentOS
December 17, 2021 ‐ 2 min read
The yum
package manager is the package manager of choice to install RPM packages on CentOS, Red Hat and Amazon Linux. No coincidence there since these three Linux distributions are closely related to each other.
Besides just installing, updating and removing packages on your system yum
conveniently provides a command to see which packages are currently installed as well.
To see which packages are installed on your system you can use the yum list
command, see the following example:
$ yum list installed
You might need to prefix the command with sudo
depending on how the permissions are set up on your system.
Since the output of the command is probably quite long you may prefer to use a terminal text viewer like less
or view
.
$ yum list installed | less
Check if a certain package is installed with yum
To search for a specific package in your installed packages, this is useful if you need to check whether a certain package is actually installed on your system, you may pipe (|
) the output to the grep
command.
For example, the following commands will list the installed packages of which the name contains the substring “python”:
$ yum list installed | grep "python"
List the installed packages with rpm
If you can use yum
you probably have access to the rpm
command as well. RPM is both a package manager as well as a file format for RPM packages. RPM is currently short for RPM Package Manager and at first as Red Hat Package Manager.
The rpm
package manager is more a low-level tool for managing packages, but for listing installed packages it is just as useful.
To list all installed packages you use the options -q
and -a
. The -q
option is used to query the installed packages, the -a
option tells rpm
to query all packages. So in order to list all the installed packages you use the following command:
$ rpm -qa
To search for a specific package that might be installed you run the command without the -a
option and provide the package name you would like to search for. For example see the following command which searches for the “python3” package:
$ rpm -q python3
python3-3.7.10-1.amzn2.0.1.x86_64
And once again: you might need to prefix the command with sudo
.