A Quick Guide To Using DNF For Package Management In Fedora

It is usually much quicker to install, remove or update packages from Linux command line after using it for a while. There will be similar package management features for various distributions regardless of how different the distributions are.

Let’s take a quick look at basic package management commands when using a non Debian distribution like Fedora (which is based on Red Hat).

Just like the apt commands in Debian for installing/updating/removing packages, Fedora has it’s own package management tool known as DNF. Fedora 22 and earlier versions used Yum for these tasks but it is now obsolete.

Here are the most common package management commands when using DNF :

commonly used dnf commands for package management in Fedora

If you have used apt commands when using Ubuntu, Debian, Linux Mint or other Debian variants, you will find these DNF commands to be pretty similar to them.

For example : To search for a package named wordgrinder in Fedora, the command will be :

sudo dnf search wordgrinder

searching for specific packages to install in Fedora using dnf

To install it, (just like apt install in Debian distros) :

sudo dnf install wordgrinder

installing packages in Fedora using dnf

To check for updates (like apt update in Debian) :

sudo dnf update

checking package updates in Fedora using dnf

Also, a list of installed packages on the system can be viewed using the list option :

sudo dnf list

It will be a long output when just the list command is run as all the packages installed will be displayed.

To check if a specific package in installed, use the list output with –installed parameter :

sudo dnf list --installed |grep wordgrinder

list of installed packages in Fedora using dnf

The above command will check if the package wordgrinder is installed on the system.

As with all the Linux commands, using the manual pages is a good way to know more :

man dnf

Also a detailed usage for all the commands can be found on the DNF page.

Happy package managing.

Comments are closed.