🎩
dnf / yum cheat sheet
dnf is the package manager for Fedora and Red Hat family systems (yum is an alias on modern releases). Most commands need sudo.
Click any command to copy it.
Update
| Command | What it does |
|---|---|
sudo dnf check-update | List available updates. |
sudo dnf upgrade | Install all available updates. |
sudo dnf upgrade --security | Install only security updates. |
sudo dnf upgrade package | Upgrade one package. |
sudo dnf needs-restarting -r | Check whether a reboot is required (needs dnf-utils). |
sudo dnf history | Show past transactions. |
Install and remove
| Command | What it does |
|---|---|
sudo dnf install package | Install a package. |
sudo dnf install -y package | Install without prompting. |
sudo dnf install ./file.rpm | Install a local RPM and its dependencies. |
sudo dnf remove package | Remove a package. |
sudo dnf autoremove | Remove unneeded dependencies. |
sudo dnf history undo ID | Destructive: Reverse a past transaction by its ID from dnf history. |
Search and inspect
| Command | What it does |
|---|---|
dnf search keyword | Search for packages. |
dnf info package | Show package details. |
dnf list installed | List installed packages. |
dnf provides /path/to/file | Find which package provides a file or command. |
rpm -qa | grep package | Check whether a package is installed. |
rpm -ql package | List the files a package installed. |
rpm -qf /path/to/file | Find which installed package owns a file. |
Repositories and groups
| Command | What it does |
|---|---|
dnf repolist | List enabled repositories. |
sudo dnf config-manager --add-repo URL | Add a repository (needs dnf-plugins-core). |
sudo dnf group install "Development Tools" | Install a package group. |
sudo dnf clean all | Clear cached metadata and packages. |
sudo dnf install epel-release | Enable EPEL extra packages on RHEL-compatible systems. |
Frequently asked questions
Is yum still used?
On RHEL 8 and later, yum is a symlink to dnf, so existing yum commands keep working.
How do I find which package provides a command?
Run dnf provides '*/command'; for example dnf provides '*/dig' shows the bind-utils package.