Find out what packages are installed on your Fedora system

The dnf command can uncover a wealth of information about what file packages are installed on Fedora and related systems

Three miniature packages sit on a computer keyboard.
Cybrain / Getty Images

If you're curious about how many packages are installed on your Fedora system or how you can check on them, you might be surprised at how much information you have at your fingertips. With just a few commands, you can find out just about anything you might want know about packages and the repositories they came from.

What is a package?

To get started, a Linux package is simply a collection of files that performs some particular tasks. For example, the popular image-editing program GIMP is installed as a package, and it includes all of the files that you need to do some impressive image editing. You can easily ask if GIMP is installed with a command like this:

$ which gimp
/usr/bin/gimp

On the other hand, you can also ask about GIMP with a command like this and uncover more details:

$ sudo dnf list gimp
Last metadata expiration check: 2:20:56 ago on Fri 16 Jul 2021 11:35:15 AM EDT.
Installed Packages
gimp.x86_64                       2:2.10.24-1.fc34                       @fedora

This command provides more details on the package including its package name and that it's the 64-bit version of the x86 instruction set.

Using dnf

As you might know, dnf replaced yum some years ago. Even if you type "yum" on the command line these days, you're probably using dnf. The command below shows that yum is simply a symbolic link to dnf.

$ ls -l /usr/bin/yum
lrwxrwxrwx. 1 root root 5 Jun 15 05:17 /usr/bin/yum -> dnf-3

In case you're wondering, dnf also points to dnf-3 (the current version of dnf).

$ ls -l /usr/bin/dnf
lrwxrwxrwx. 1 root root 5 Jun 15 05:17 /usr/bin/dnf -> dnf-3

To find out about all of the packages that comprise GIMP, use a command like this:

$ sudo dnf list installed | grep gimp
gimp.x86_64                                2:2.10.24-1.fc34                     @fedora
gimp-libs.x86_64                           2:2.10.24-1.fc34                     @fedora

The output above lists two GIMP packages. The second contains the libraries. That "2.10.24" in the middle fields indicates the release that is installed, which is the latest stable version of this tool. The "fc34" string indicates that these packages are meant for Fedora 34.

To list more installed packages, you can run a command like this:

$ sudo dnf list installed | head -11
Installed Packages
AtomicParsley.x86_64                              0.9.5-17.fc34          @fedora
Box2D.x86_64                                      2.4.1-5.fc34           @fedora
LibRaw.x86_64                                     0.20.2-2.fc34          @fedora
ModemManager.x86_64                               1.16.6-1.fc34          @updates
ModemManager-glib.x86_64                          1.16.6-1.fc34          @updates
NetworkManager.x86_64                             1:1.30.4-1.fc34        @updates-testing
NetworkManager-adsl.x86_64                        1:1.30.4-1.fc34        @updates-testing
NetworkManager-bluetooth.x86_64                   1:1.30.4-1.fc34        @updates-testing
NetworkManager-config-connectivity-fedora.noarch  1:1.30.4-1.fc34        @updates-testing
NetworkManager-libnm.x86_64                       1:1.30.4-1.fc34        @updates-testing

This display lists the packages and release information and, on the far right, it references the repositories from which these packages were derived or last updated.

If you're curious about how many packages will be listed when you run the command without piping its output to the head command, try this:

$ sudo dnf list installed | wc -l
1901

This shows you that, on this system, 1900 packages are installed (1901 includes the "Installed Packages" heading).

To get a feel for how many repositories are involved and how many packages/updates are associated with each, you can try a command like this:

$ sudo dnf list installed | grep -v '^Installed' | awk '{print $3}' | sort | uniq -c
      1 @anaconda
    983 @fedora
      3 @fedora-cisco-openh264
    705 @updates
    207 @updates-testing

The lines show package counts by source repository. You can also get a list of information on repositories like this:

$ sudo dnf repolist
repo id                        repo name
fedora                         Fedora 34 - x86_64
fedora-cisco-openh264          Fedora 34 openh264 (From Cisco) - x86_64
fedora-modular                 Fedora Modular 34 - x86_64
updates                        Fedora 34 - x86_64 - Updates
updates-modular                Fedora Modular 34 - x86_64 – Updates

The first line shows the headings for the list. If you add a -v (e.g., sudo dnf repolist -v), you'll see a lot more detail on each repository. The command below provides details for the first listed repository.

$ sudo sudo dnf repolist -v | head -15
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, system-upgrade, uploadprofile
DNF version: 4.8.0
cachedir: /var/cache/dnf
Last metadata expiration check: 3:19:09 ago on Sun 18 Jul 2021 07:00:51 AM EDT.
Repo-id            : fedora
Repo-name          : Fedora 34 - x86_64
Repo-revision      : 1619174877
Repo-updated       : Fri 23 Apr 2021 06:47:57 AM EDT
Repo-pkgs          : 63,586
Repo-available-pkgs: 63,586
Repo-size          : 78 G
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=fedora-34&arch=x86_64
  Updated          : Sun 18 Jul 2021 07:00:49 AM EDT
Repo-baseurl       : https://mirrors.rit.edu/fedora/fedora/linux/releases/34/Everything/x86_64/os/ (67 more)
Repo-expire        : 604,800 second(s) (last: Sun 18 Jul 2021 07:00:49 AM EDT)
Repo-filename      : /etc/yum.repos.d/fedora.repo

To get more information on a specific repository, you can run a command like this one:

$ sudo dnf -v repolist updates
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, system-upgrade, uploadprofile
DNF version: 4.8.0
cachedir: /var/cache/dnf
Last metadata expiration check: 3:21:54 ago on Sun 18 Jul 2021 07:00:51 AM EDT.
Repo-id            : updates
Repo-name          : Fedora 34 - x86_64 - Updates
Repo-status        : enabled
Repo-revision      : 1626568076
Repo-updated       : Sat 17 Jul 2021 08:53:12 PM EDT
Repo-pkgs          : 13,267
Repo-available-pkgs: 13,267
Repo-size          : 25 G
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=updates-released-f34&arch=x86_64
  Updated          : Sun 18 Jul 2021 07:00:51 AM EDT
Repo-baseurl       : https://mirrors.rit.edu/fedora/fedora/linux/updates/34/Everything/x86_64/
                   : (67 more)
Repo-expire        : 21,600 second(s) (last: Sun 18 Jul 2021 07:00:51 AM EDT)
Repo-filename      : /etc/yum.repos.d/fedora-updates.repo
Total packages: 13,267

The "Total packages" count at the bottom refers to the repository, not the system that the command is running on.

Checking out the "extras"

To list packages which are installed on your system, but not associated with any repository listed in the config file, use a command like this:

$ sudo dnf list --extras
Last metadata expiration check: 2:49:13 ago on Sat 17 Jul 2021 10:29:08 AM EDT.
Extra Packages
adwaita-qt4.x86_64               1.1.3-4.fc33                       @anaconda
speedtest.x86_64                 1.0.0.2_1.5ae238b-1                @bintray--ookla-rhel

To list all available packages in enabled repositories, do this:

$ sudo dnf list --available | wc -l
63490

Comparing these numbers can point out how few packages are installed compared to how many are available.

$ sudo dnf list --installed | wc -l
1901
$ sudo dnf list --all | wc -l
65391
$ sudo dnf list --available | wc -l
63490

Wrap-up

Linux distributions include thousands of packages with many thousands more available. On Fedora and related distros, the dnf command can provide a lot of detail on the packages installed on your system and the repositories in use.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.
Related:

Copyright © 2021 IDG Communications, Inc.

SD-WAN buyers guide: Key questions to ask vendors (and yourself)