dnf Command Examples

Dandified YUM or DNF is the name of the package management utility. DNF is the next-generation version of YUM. It’s used in RPM-based distributions. DNF was introduced in Fedora 18, and has been the default package manager for Fedora since version 22. In fact, when we run YUM commands in later releases of Fedora, we are actually running dnf in the background. The dnf utility offers, among other things, performance, memory usages, and dependency resolution.

Using dnf to Manage Repositories

1. List all installed repositories, enabled and disabled:

$ dnf repolist --all

2. List enabled repositories:

$ dnf repolist --enabled

3. Show detailed information on enabled repositories:

$ dnf repolist --enabled

4. Add a repository:

$ sudo dnf config-manager --add-repo /etc/yum.repos.d/fedora_extras.repo

5. Enable the repository:

$ sudo dnf config-manager --set-enabled fedora-extras

6. Disable the repository:

$ sudo dnf config-manager --set-disabled fedora-extras

Using dnf to Manage Software

1. Search for a package:

$ dnf search packagename

2. Install a package:

$ sudo dnf install packagename

3. Remove a package:

$ sudo dnf remove packagename

4. Get information about a package:

$ dnf info packagename

5. Install updates:

$ sudo dnf upgrade

6. Get a list of package groups:

$ dnf grouplist

7. Install a package group:

$ sudo dnf groupinstall "package-group"

8. Remove a package group:

$ sudo dnf groupremove "package-group"

Configuration files

/etc/dnf/dnf.conf – DNF configuration file
/etc/yum.repos.d – all repo files

Conclusion

DNF stands for “DaNdiFied YUM.” The syntax of DNF commands are identical to those of YUM making the switch from YUM to DNF easy. DNF can install and remove packages. It can also install updates and provide us with information about installed packages and packages that are available in the repositories and which have not been installed. DNF allows packages that have been signed to be automatically checked to prevent counterfeit packages from installing malware on your Fedora system.

Related Post