dnf: command not found

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.

If you encounter the below error while running the dnf command:

dnf: command not found

you may try installing the dnf package as per your choice of distribution:

Distribution Command
CentOS yum install dnf
Fedora dnf install dnf

dnf Command Examples

1. check the version of dnf:

$ sudo dnf --version

2. view the repositories on our system by passing the repolist option:

$ sudo dnf repolist

or

$ sudo dnf repolist all

3. view all the available packages on our system, we use the list option:

$ sudo dnf list

4. We can perform searches similar to YUM. For this, we use the search option:

$ sudo dnf search firefox

5. To view which package provides a particular utility, we use the provides option:

$ sudo dnf provides /bin/ksh

6. In addition to this, we can view information for a specific package using the info option:

$ sudo dnf info libreoffice

7. Check for system updates by using the check-update option:

$ sudo dnf check-update

8. To install a package, we use the install option:

$ sudo dnf install firefox

9. Similarly, to remove a package, we use the remove option:

$ sudo dnf remove firefox

10. Remove packages that were only needed to satisfy dependencies:

$ sudo dnf autoremove

11. To see the various dnf commands that were executed, we can use the history option:

$ sudo dnf history

12. Upgrade installed packages to the newest available versions:

$ sudo dnf upgrade

13. Display details about a package:

$ dnf info package

14. Before we update our system, it’s always a good idea to do some housekeeping. We can use the clean all option for this:

$ sudo dnf clean all

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