DNF Cheat Sheet
Dandified Yum (DNF) is an RPM-based package manager which is used to install and update packages in various Linux distributions, including CentOS, RHEL and Fedora.
DNF is a fork of the YUM package manager, it aims to improve performance and reduce memory usage. DNF was introduced in Fedora 18 and became the default in Fedora 22.
The goal of this article is to highlight common DNF commands (acting as a cheat sheet).
Prior to proceeding, it is important to understand the difference between a repository and a package.
- A repository containers packages.
- A package contains an application.
Repositories and packages simplify software distribution and installation.
List All Repositories
The following command will list all repositories, highlighting if they are enabled or disabled.
sudo dnf repolist all
List All Packages
The following command will list all packages from installed repositories.
dnf list available | more
List Installed Packages
The following command will list all installed packages.
dnf list installed
Install Package
The following command will install a specific package.
sudo dnf install <package>
Remove Package
The following command will remove a specific package.
sudo dnf remove <package>
Check for Updates
The following command will check for updates across all enabled repositories. It does not install the updates.
sudo dnf check-update
Update All Packages
The following command will update all packages.
sudo dnf upgrade --refresh
Update Package
The following command will update a specific package.
sudo dnf update <package>
View Package Information
The following command will show the details of a specific package.
dnf info <package>
Remove Orphan Packages
The following command will remove any packages that are no longer required.
sudo dnf autoremove
Synchronise All Packages
The following command will synchronise all packages to the latest stable release.
sudo dnf distro-sync
Get Help
The following command will list all available DNF options.
dnf help
Additional information regarding DNF can be found on the Fedora Wiki.