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
|APT stands for Advanced Packaging Tool||DNF stands for DaNdiFied (Dandified) Yum|
|apt works with packages in the .deb format||dnf 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 lists||dnf updates the repo lists automatically|
|apt was first introduced in Debian Distro||dnf 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|
|slower than apt on tests to resolve dependencies and install packages|
|cannot download and install from URLs directly, it needs .deb packages||can download and install from URLs directly|
|supports one-click install||doesn’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.
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
- apt and dnf commands that use similar keywords (like apt install and dnf install)and they do the same function in our system.
- apt and dnf commands that use similar keywords, but they don’t do the same function in our system.
- apt and dnf commands that don’t have similar keywords but do the same function in our system.
Similar commands and Same functions
|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
|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 update||updates the sources list||dnf update||Deprecated alias for upgrade command|
Non-similar commands and same functions
|Function||APT command||DNF command|
|shows information about a software package||apt 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.
If you liked the post, feel free to share this post with your friends and colleagues!