There might come a time when you want to know if you have already installed a certain package on your RHEL 8 / CentOS 8. An application to be manually installed might require certain dependencies to work so you’ll have to check beforehand if these are satisfied. Or you might want to compile something and want to make sure you have all the right header libraries on your system.
In this tutorial you will learn:
- How to use yum and dnf in RHEL 8 / CentOS 8 to list all packages
- How to use the repoquery command to accomplish the same task
- How to use the rpm command to list all packages installed on RHEL 8 / CentOS 8
- How to filter the output of each command to seek certain packages
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | RHEL 8 / CentOS 8 |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Using yum and dnf
One way to check what you have installed using yum
or dnf
and the RHEL 8 / CentOS 8 repositories is to use
$ dnf list installed OR $ yum list installed
This will list all installed packages in alphabetical order. You can pipe the output to grep
if you are looking for something in particular, say anything related to the bzip2
package:
$ dnf list installed | grep bzip2
As you can see in the image below, the command lists both the bzip2
binary package and the bzip2
library package. You even get the version number of the software so, if you might need an earlier version installed, you’ll know when to downgrade. The dnf
command works exactly the same way as yum
, with the same attributes, so you can use that if you fancy it.
Use the repoquery command
Another way to list available packages is to use dnf-utils
. The package set is used to manage repositories and one of its functions is the ability to list installed packages. Make sure you installed dnf-utils
with
# dnf install dnf-utils
then use the repoquery
command that comes with dnf-utils
to list all installed packages:
$ repoquery -a --installed
Same as with the piped grep
above, we can also use grep
here to filter what we are interested in:
$ repoquery -a --installed | grep bzip2
List installed packages using the rpm command
A third way to list installed packages is to use the rpm
command and make it do a query for all installed packages:
$ rpm -qa
If you want to look for all packages pertaining to bzip2
use
$ rpm -qa bzip2*
And finally – the GUI
If you want to use a graphical user interface, the Software package management application offers a tab listing all installed applications. The downside being that it only lists the names of the applications and not their package names; dependencies are also not shown and the overall information provided is limited.