DNF vs APT: Similarities and Differences Analyzed!

In this article let’s look at the 2 most popular package management software apt and dnf and analyze their similarities and differences in detail.

A Quick Comparison of APT and DNF

APTDNF
APT stands for Advanced Packaging ToolDNF stands for DaNdiFied (Dandified) Yum
apt works with packages in the .deb formatdnf works with packages in .rpm format
apt is the front-end of dpkg (Debian Package Manager)dnf is the front-end of RPM (RedHat Package Manager)
apt needs manual updating of the repo listsdnf updates the repo lists automatically
apt was first introduced in Debian Distrodnf was first introduced in Fedora
apt is used in Debian and all its derivatives like Ubuntu, Knoppix, etc.dnf is used in RHEL, Fedora, CentOS, and other derivatives pf RHEL
faster than dnf on tests to resolve dependencies and install packages
(Reference link)
slower than apt on tests to resolve dependencies and install packages
cannot download and install from URLs directly, it needs .deb packagescan download and install from URLs directly
supports one-click installdoesn’t support one-click installs

The table above shows a quick comparison of APT and DNF. Let’s take a deeper look at both these package manager tools and try to understand them better in this article.

What are the functionalities fulfilled by apt, dnf and similar class of tools?

APT and DNF belong to the “package manager” class of tools. I have already written an article on package managers and the link to it is given below.

A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm

In that article, I have explained

  • What are packages in a Linux system
  • Content of packages
  • Need for package managers
  • Functions of package managers and
  • the architecture of packages managers

If you haven’t already, please go ahead and read that one before continuing this article as that article should clear up most of the confusion that is common with beginners who would like to learn more about “apt” and “dnf” commands.

Alright, I guess by now, you have read that article and you are more familiar with the role of package managers in our Linux systems.

Let’s go ahead and compare some commands provided by apt and dnf and look at their similarities and differences.

Comparison of apt and dnf commands

I have divided this section into 3 categories

  1. apt and dnf commands that use similar keywords (like apt install and dnf install)and they do the same function in our system.
  2. apt and dnf commands that use similar keywords, but they don’t do the same function in our system.
  3. apt and dnf commands that don’t have similar keywords but do the same function in our system.

Similar commands and Same functions

APTDNFFUNCTION
apt install <software name> dnf install <software name> acquires the software from the repo and installs it on your system
apt list <options> dnf list <options> shows a list of packages, the options can be installed, available, upgradable, etc.
apt search <keyword> dnf search <keyword> if you only remember part of the software name then you can use this command to get the names of software matching the provided string.

Similar commands and Different functions

APTDNF
CommandFunction Command Function
apt remove <software name> removes only mentioned packages
(use apt autoremove to remove the dependencies)
dnf remove <software name> removes mentioned packages and its dependencies
apt upgrade upgrades all the packages installed in your system to their latest available version in the repo. (doesn’t update the sources list) dnf upgrade after updating the sources list this command upgrades all the packages installed in your system to their latest available version in the repo and then goes ahead and removes unnecessary dependencies
apt updateupdates the sources listdnf update Deprecated alias for upgrade command

Non-similar commands and same functions

FunctionAPT commandDNF command
shows information about a software packageapt show <software name> dnf info <software name>
shows dependencies of a software package apt show <software name>
(same one as above)
dnf deplist <software name>

Spending some time to learn and memorize these tables should help you when switching from one package manager to another. Or you can also bookmark this page and come back to it when you need to.

And with that, I will conclude this article!

I hope you guys enjoyed this article and learned something useful. 

You can email us or contact us through this link if you have any questions or suggestions.

If you liked the post, feel free to share this post with your friends and colleagues!

Related Articles

A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm

apt & apt-get Explained For Beginners!

yum & dnf Explained for Beginners!

Linux Distros That Uses apt commands for Package Management

Linux Distros That Uses Yum or DNF for Package Management

References

A Comparison of Popular Linux Package Managers

EI

We’re passionate about inventing embedded devices and we hope you are too! This blog deals with a wide variety of topics from C programming to IOT to networking certifications and more. Hope you enjoy your time spent here and hope you get some value out of our blog!

You may also like...