DNF Package Manager Quick Reference

Peter Boy (pboy), The Fedora Docs Team Versio F37 onwards Last review: 2023-08-29

This sections lists the most useful commands provided by the dnf utility. For a complete list of commands, options, and their syntax, see the dnf(8) man page.

dnf help command

Displays detailed information about a command.

$ dnf help upgrade
upgrade [PACKAGE...]

upgrade a package or packages on your system
alias: update
dnf upgrade

Upgrades all packages on the system to the latest version available.

# dnf upgrade
Last metadata expiration check: 1:09:32 ago on Thu Dec 14 09:20:48 2017.
Dependencies resolved.
Nothing to do.
Complete!
dnf upgrade package_name

Upgrades a package to the latest version available.

# dnf upgrade dia
Last metadata expiration check: 1:11:26 ago on Thu Dec 14 09:20:48 2017.
Dependencies resolved.
Nothing to do.
Complete!
dnf install package_name

Installs a package.

# dnf install dia
Last metadata expiration check: 1:07:19 ago on Thu Dec 14 09:20:48 2017.
Dependencies resolved.
=============================================================================
 Package          Arch           Version           Repository           Size
=============================================================================
Installing:
 dia              x86_64         1:0.97.3-5.fc24   fedora               4.2 M
 libart_lgpl      x86_64         2.3.21-15.fc25    fedora               71 k

Transaction Summary
=============================================================================
Install  2 Packages

Total download size: 4.2 M
Installed size: 18 M
Is this ok [y/N]: y
[... output truncated ...]
Installed:
  dia.x86_64 1:0.97.3-5.fc24          libart_lgpl.x86_64 2.3.21-15.fc25

Complete!
dnf remove package_name

Uninstalls a package.

# dnf remove dia
Dependencies resolved.
=============================================================================
 Package          Arch           Version           Repository           Size
=============================================================================
Removing:
 dia              x86_64         1:0.97.3-5.fc24   @fedora              18 M
 libart_lgpl      x86_64         2.3.21-15.fc25    @fedora              126 k

Transaction Summary
=============================================================================
Remove  2 Packages

Installed size: 18 M
Is this ok [y/N]: y
[... output truncated ...]
Removed:
  dia.x86_64 1:0.97.3-5.fc24           libart_lgpl.x86_64 2.3.21-15.fc25

Complete!
dnf check-update

Checks if any updates are available for all packages in the enabled repositories.

389-ds-base.x86_64                    1.3.7.5-11.el7           @updates
389-ds-base-libs.x86_64               1.3.7.5-11.el7           @updates
NetworkManager.x86_64                 1:1.10.2-3.el7           @updates
NetworkManager-config-server.noarch   1:1.10.2-3.el7           @updates
[... output truncated ...]
dnf search keyword

Search package metadata in the enabled repositories for the specified keyword. By default, the commands searches only in package names and summaries.

# dnf search freeipa
Last metadata expiration check: 1:12:31 ago on Thu Dec 14 09:20:48 2017.
========================================================================
freeipa-client.x86_64 : IPA authentication for use on clients
freeipa-common.noarch : Common files used by IPA
freeipa-server.x86_64 : The IPA authentication server
freeipa-server-dns.noarch : IPA integrated DNS server with support for automatic DNSSEC signing
freeipa-client-common.noarch : Common files used by IPA client
freeipa-python-compat.noarch : Compatiblity package for Python libraries used by IPA
freeipa-server-common.noarch : Common files used by IPA server
freeipa-server-trust-ad.x86_64 : Virtual package to install packages required for Active Directory trusts
libsss_idmap.x86_64 : FreeIPA Idmap library
[... output truncated ...]
dnf info package_name

Shows details for a package.

[root@localhost ~]# dnf info freeipa-server
Last metadata expiration check: 1:13:14 ago on Thu Dec 14 09:20:48 2017.
Available Packages
Name        : freeipa-server
Arch        : x86_64
Epoch       : 0
Version     : 4.4.4
Release     : 1.fc25
Size        : 380 k
Repo        : updates
Summary     : The IPA authentication server
URL         : https://www.freeipa.org/
License     : GPLv3+
Description : IPA is an integrated solution to provide centrally managed Identity (users,
            : hosts, services), Authentication (SSO, 2FA), and Authorization
            : (host access control, SELinux user roles, services). The solution provides
            : features for further integration with Linux based clients (SUDO, automount)
            : and integration with Active Directory based infrastructures (Trusts).
            : If you are installing an IPA server, you need to install this package.
dnf provides command_or_file

Shows which package provides the specified command or file.

To specify a command:

# dnf provides */ipa-server-install
Last metadata expiration check: 1:14:12 ago on Thu Dec 14 09:20:48 2017.
freeipa-server-4.4.1-1.fc25.x86_64 : The IPA authentication server
Repo        : fedora

freeipa-server-4.4.4-1.fc25.x86_64 : The IPA authentication server
Repo        : updates

To specify a file:

# dnf provides /etc/sssd/sssd.conf
Last metadata expiration check: 1:14:58 ago on Thu Dec 14 09:20:48 2017.
sssd-common-1.16.0-4.fc25.x86_64 : Common files for the SSSD
Repo        : @System

sssd-common-1.16.0-4.fc25.x86_64 : Common files for the SSSD
Repo        : updates

sssd-common-1.14.2-1.fc25.i686 : Common files for the SSSD
Repo        : fedora

sssd-common-1.14.2-1.fc25.x86_64 : Common files for the SSSD
Repo        : fedora
dnf history

Displays a report of the past transactions.

# dnf history
ID     | Command line             | Date and time    | Action(s)      | Altered
 -------------------------------------------------------------------------------
     9 | update -y                | 2017-10-17 12:35 | I, U           |   17 EE
     8 | install midori           | 2017-10-13 10:44 | Install        |    3 >
     7 | update -y                | 2017-10-12 15:59 | Update         |    7
     6 | install keepass          | 2017-10-11 13:40 | Install        |   13  <
     5 | install thunderbird      | 2017-10-10 16:33 | Install        |    1 >
     4 | install sssd krb5-workst | 2017-10-10 15:30 | Install        |    3 >
     3 | install xchat            | 2017-10-10 15:19 | Install        |    4
     2 | update                   | 2017-10-10 13:44 | I, O, U        |  752 EE
     1 |                          | 2017-10-10 13:34 | Install        | 1373 EE
dnf list installed

Lists all packages installed on the system.

# dnf list installed
Last metadata expiration check: 1:17:33 ago on Thu Dec 14 09:20:48 2017.
Installed Packages
GConf2.x86_64                                                                                         3.2.6-16.fc24                                                                             @anaconda
GeoIP.x86_64                                                                                          1.6.11-1.fc25                                                                             @updates
GeoIP-GeoLite-data.noarch                                                                             2017.10-1.fc25                                                                            @updates
ImageMagick.x86_64                                                                                    6.9.9.19-1.fc25                                                                           @updates
ImageMagick-libs.x86_64                                                                               6.9.9.19-1.fc25                                                                           @updates
LibRaw.x86_64                                                                                         0.17.2-2.fc25                                                                             @updates
ModemManager.x86_64                                                                                   1.6.4-1.fc25                                                                              @updates
ModemManager-glib.x86_64                                                                              1.6.4-1.fc25                                                                              @updates
NetworkManager.x86_64                                                                                 1:1.4.6-1.fc25                                                                            @updates
[... output truncated ...]