dnf Cheatsheet
#
dnf (Dandified YUM) is the next-generation version of the yum
package manager used in Fedora and other Red Hat-based distributions. It handles the installation, removal, and management of software packages on these systems.
Basic Commands
#
Command/Option | Example | Description |
---|
dnf install | sudo dnf install package-name | Install a package |
dnf remove | sudo dnf remove package-name | Remove a package |
dnf update | sudo dnf update | Update all installed packages |
dnf upgrade | sudo dnf upgrade | Upgrade all installed packages |
dnf search | dnf search package-name | Search for a package |
dnf info | dnf info package-name | Display information about a package |
dnf list | dnf list installed | List all installed packages |
dnf list available | dnf list available | List all available packages |
dnf clean all | sudo dnf clean all | Clean all cached files |
dnf repoquery | dnf repoquery --list package-name | Query the repository for package details |
Repository Management
#
Command/Option | Example | Description |
---|
dnf repolist | dnf repolist | List all enabled repositories |
dnf-config-manager --add-repo | sudo dnf-config-manager --add-repo=https://example.repo | Add a new repository |
dnf-config-manager --set-enabled | sudo dnf-config-manager --set-enabled repo-name | Enable a repository |
dnf-config-manager --set-disabled | sudo dnf-config-manager --set-disabled repo-name | Disable a repository |
Package Group Management
#
Command/Option | Example | Description |
---|
dnf groupinstall | sudo dnf groupinstall "Development Tools" | Install a package group |
dnf groupremove | sudo dnf groupremove "Development Tools" | Remove a package group |
dnf groupinfo | dnf groupinfo "Development Tools" | Display information about a package group |
History and Transactions
#
Command/Option | Example | Description |
---|
dnf history | dnf history | Show transaction history |
dnf history info | dnf history info transaction-id | Show details about a specific transaction |
dnf history undo | sudo dnf history undo transaction-id | Undo a specific transaction |
dnf history redo | sudo dnf history redo transaction-id | Redo a specific transaction |
Plugin Management
#
Command/Option | Example | Description |
---|
dnf plugin list | dnf plugin list | List all available plugins |
dnf plugin disable | sudo dnf plugin disable plugin-name | Disable a specific plugin |
dnf plugin enable | sudo dnf plugin enable plugin-name | Enable a specific plugin |
This cheatsheet covers the essential dnf
commands for package management, repository management, and history operations in Fedora and other Red Hat-based distributions.