Updated: 12 October 2026 · Applies to: AlmaLinux 9.8 and 10.2, Rocky Linux 9.8 and 10.2 (dnf 4), Fedora 44 (dnf5 5.4.6), RHEL 9 and 10 (UBI minimal images with microdnf), CentOS 7.9 (vault repositories)

To list every installed package on RHEL, AlmaLinux, Rocky Linux or Fedora, run rpm -qa. For the same list with the repository each package came from, run dnf list --installed. To list your yum repositories, run dnf repolist (enabled ones) or dnf repolist --all (enabled and disabled). The old yum commands still work: on AlmaLinux and Rocky Linux 9 and 10, yum is a link to dnf, and on Fedora both point to dnf5.

1. rpm: every installed package

rpm -qa | sort

This reads the local package database, so it works even when no repository is reachable. Useful variations:

  • Count them: rpm -qa | wc -l (162 on our AlmaLinux 9 test system)
  • Names only, without versions: rpm -qa --qf '%{NAME}\n' | sort
  • Newest installs and updates first: rpm -qa --last | head -20
  • Is one package installed? rpm -q nginx prints the version, or package nginx is not installed
  • Find installed packages by part of the name: rpm -qa | grep -i openssl
  • Details of one package (version, install date, licence): rpm -qi nano

Entries such as gpg-pubkey-350d275d-6279464b are imported signing keys, not software. More in install, query, verify and remove packages with rpm.

2. dnf list --installed: with the repository

$ dnf list --installed
Installed Packages
acl.x86_64                              2.4.0-1.el9_8                    @baseos
almalinux-gpg-keys.x86_64               9.8-1.el9                        @baseos
...

The third column is the repository, for example @baseos, @appstream or @epel. Packages that came with a container image or the installer can show an internal ID there instead. dnf list installed and yum list installed give the same result. Only the packages from one repository: dnf list --installed | grep @epel.

3. Only the packages you installed yourself

dnf repoquery --userinstalled

This leaves out packages pulled in only as dependencies, so it is the best list for rebuilding a server. It also shows the base packages chosen when the system was installed (for example bash).

In minimal containers such as Red Hat UBI minimal, microdnf has no list command (it answers This is microdnf, which implements subset of `dnf'.). Use microdnf repoquery --installed or rpm -qa there.

4. Search for packages

$ dnf search nginx
========================= Name Exactly Matched: nginx ==========================
nginx.x86_64 : A high performance web server and reverse proxy server
======================== Name & Summary Matched: nginx =========================
collectd-nginx.x86_64 : Nginx plugin for collectd
munin-nginx.noarch : NGINX support for Munin resource monitoring
  • dnf search --all WORD also searches descriptions and URLs.
  • Which package provides a command or file? dnf provides '*/bin/htpasswd' answered httpd-tools on AlmaLinux 9 and 10 and Fedora 44.
  • Version, repository and description before you install: dnf info nginx
  • Which installed package owns a file? rpm -qf /usr/bin/ls. See also where a package installed its files.

5. List all available versions of a package

$ dnf list --showduplicates nginx
Available Packages
nginx.x86_64                2:1.20.1-28.el9_8.4.alma.1                 appstream
nginx.x86_64                2:1.20.1-28.el9_8.5.alma.1                 appstream
nginx.x86_64                2:1.20.1-28.el9_8.6.alma.1                 appstream

This is the modern form of yum list --showduplicates. To install one of them, add the version and release to the name without the epoch (2:), for example sudo dnf install nginx-1.20.1-28.el9_8.5.rocky.0.1 on Rocky Linux 9. On AlmaLinux and Rocky Linux 9, newer major versions can come as module streams: dnf module list nginx showed streams 1.22, 1.24 and 1.26. AlmaLinux 10 has no modules; there the list showed 1.26.3 directly.

6. List yum repositories (dnf repolist)

dnf repolist              # enabled repositories (same as yum repolist)
dnf repolist --all        # enabled and disabled
dnf repolist --disabled   # disabled only

On a fresh AlmaLinux 9.8 system (lab output, cut short):

$ yum repolist
repo id                          repo name
appstream                        AlmaLinux 9 - AppStream
baseos                           AlmaLinux 9 - BaseOS
extras                           AlmaLinux 9 - Extras

$ dnf repolist --all
repo id                      repo name                                  status
appstream                    AlmaLinux 9 - AppStream                    enabled
...
crb                          AlmaLinux 9 - CRB                          disabled
...
extras                       AlmaLinux 9 - Extras                       enabled
highavailability             AlmaLinux 9 - HighAvailability             disabled

What the standard repositories are for:

  • baseos: the core operating system packages.
  • appstream: applications, languages and databases (PHP, MariaDB, MySQL, nginx).
  • extras: extra packages from the distribution, such as epel-release.
  • crb (CodeReady Linux Builder): development libraries that many EPEL packages need. Disabled by default on AlmaLinux 9 and Rocky Linux 9 and 10; AlmaLinux 10 enables it by default.
  • highavailability, nfv, rt, sap, saphana (and resilientstorage and plus on AlmaLinux 9): special-purpose repositories, disabled until you need them. Each also has -debuginfo and -source variants.

Rocky Linux 9.8 and 10.2 showed the same main IDs, plus disabled devel and security repositories.

Repository URLs and package counts

Each repository is a section in a .repo file in /etc/yum.repos.d/. dnf repoinfo shows the file, the mirror list and the package count:

$ dnf repoinfo baseos
Repo-id            : baseos
Repo-name          : AlmaLinux 9 - BaseOS
Repo-status        : enabled
Repo-pkgs          : 3332
Repo-mirrors       : https://mirrors.almalinux.org/mirrorlist/9/baseos
Repo-filename      : /etc/yum.repos.d/almalinux-baseos.repo

(Lab output from our test container, some lines left out.) dnf repolist -v prints the same block for every enabled repository. The official addresses are in the repo files themselves:

$ grep -E '^\[|^mirrorlist|baseurl' /etc/yum.repos.d/almalinux-baseos.repo | head -3
[baseos]
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos
# baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/

On Rocky Linux the file is /etc/yum.repos.d/rocky.repo, with mirrors.rockylinux.org as the mirror list and dl.rockylinux.org as the commented base URL. Keep the mirror list unless you have a reason to pin one server. A broken file causes errors such as Bad id for repo.

Enable a repository and list its packages

sudo dnf config-manager --set-enabled crb
sudo dnf install epel-release
dnf repolist
dnf --repo=epel list available

After these two steps, dnf repolist on AlmaLinux 9 also showed crb, epel and epel-cisco-openh264. The last line lists only the packages that EPEL offers. To run your own repository, see host your own DNF repository.

Fedora, RHEL and CentOS 7

  • Fedora (dnf5): dnf repolist and dnf repolist --all work, as does dnf repo list --all. Without the dashes, dnf repolist all only answered No matches found. on Fedora 44. Details: dnf repo info fedora.
  • RHEL with a subscription: according to Red Hat, subscription-manager repos --list-enabled shows the enabled repositories, with IDs such as rhel-9-for-x86_64-baseos-rpms and rhel-9-for-x86_64-appstream-rpms. dnf repolist works there too.
  • CentOS 7 has reached end of life and its mirror list is gone. yum repolist printed Could not resolve host: mirrorlist.centos.org and repolist: 0. The packages are still archived on vault.centos.org:
sudo cp -a /etc/yum.repos.d /root/yum.repos.d.bak
sudo sed -i -e 's/^mirrorlist=/#mirrorlist=/' \
  -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|' \
  /etc/yum.repos.d/CentOS-*.repo
sudo yum clean all
yum repolist
repo id                             repo name                             status
base/7/x86_64                       CentOS-7 - Base                       10072
extras/7/x86_64                     CentOS-7 - Extras                       526
updates/7/x86_64                    CentOS-7 - Updates                    6173
repolist: 16771

The vault gets no security updates, so use it only to keep an old server running while you move to AlmaLinux or Rocky Linux.

7. What changed and when

dnf history
dnf history info 3

On Fedora the first command is dnf history list. See dnf history for undoing a transaction.

Save the list and reinstall it on another server

  1. On the old server, save the names of the packages you installed:
    dnf repoquery --userinstalled --qf '%{name}' | sort -u > packages.txt
    With dnf5 on Fedora, add \n to the format (--qf '%{name}\n'), or all names end up on one line.
  2. Compare dnf repolist on both servers and enable the same extra repositories on the new one (for example dnf install epel-release).
  3. Copy packages.txt over and run:
    sudo dnf install $(cat packages.txt)

Other systems and other software

On Ubuntu and Debian, use apt list --installed and list your APT repositories; on openSUSE, see list installed packages on SUSE. Programs installed outside the package manager (compiled into /usr/local, installed with pip, or running in containers) do not appear in any of these lists.

Official documentation: DNF command reference, Managing software with the DNF tool (RHEL 9), AlmaLinux repositories and RPM documentation.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)