Guides 11792 Published by

The guide explains how to quickly list every RPM installed on RHEL and CentOS machines using yum or dnf, so administrators can see the full stack after a fresh install or for audit purposes. It shows commands like “yum list installed” for RHEL 7 and CentOS 7, switching to “dnf list installed” on newer releases, and also offers filtering options with grep or dnf repoquery to narrow down by package name or repository source. For compliance work the article suggests redirecting the output into a text file so you can later compare snapshots or import the data into spreadsheets for sorting. Finally it highlights quick checks such as “rpm -q curl” and gives a real‑world example where missing httpd modules caused service outages, illustrating how to troubleshoot with these tools.



List Installed Packages in RHEL and CentOS – Quick Cheat Sheet

If you’ve just finished a clean install or pulled up a production server that’s been running for years, you’ll probably want to see every package the OS is actually using. Knowing the full inventory can help spot rogue updates, missing dependencies, or simply satisfy that curiosity about how many RPMs live in your system.

List Installed Packages with yum or dnf

For most RHEL 7 and CentOS 7 boxes, yum list installed is the fastest way to dump everything into your terminal. On newer releases that ship with DNF (RHEL 8 / CentOS 8), just replace yum with dnf. The command prints the package name, version, release, architecture, and the repo it came from – all in one neat table.

You’ll get a snapshot of what’s actually present, not just what you think is installed. It also shows you which packages were pulled from which repository, so if something looks out of place (like an unexpected vendor package), you can track its source immediately.

# RHEL 7 / CentOS 7
yum list installed

# RHEL 8 / CentOS 8
dnf list installed
Filtering the Output for Specific Packages or Repos

If you only care about a handful of packages, pipe the output to grep. For example, to find every variant of Apache in your system:

yum list installed | grep httpd

You can also ask DNF to list only what’s pulled from enabled repos, which is handy when you have local repositories or third‑party modules that clutter the full list.

dnf repoquery --installed

That command filters out anything not coming from an enabled repository, giving you a cleaner view of the official stack.

Exporting to a File for Auditing

When you’re preparing for a compliance audit or just want a permanent record, redirect the output into a plain text file. It’s useful later when you compare two snapshots or feed the data into a spreadsheet.

yum list installed > /tmp/installed-packages.txt

Now you can open that file in any editor or import it into tools like Excel to sort by version or repo.

Quick Check for a Single Package

Sometimes you just need to confirm whether a particular package is present. The rpm -q command does exactly that, and it fails fast if the package is missing – no table output cluttering your screen.

rpm -q curl

If the result starts with “curl‑”, the package exists; otherwise, you’ll see something like “package curl was not installed”.

Real‑World Example

I once had a CentOS 7 web server that suddenly stopped serving static files after a routine yum update. The logs pointed to a missing httpd module. Running yum list installed | grep httpd revealed that the package had been removed during an automated cleanup, leaving behind a half‑installed dependency set. Reinstalling with yum install httpd and then verifying with rpm -q httpd fixed the issue in minutes.