Tools › Cheat sheets › System Administration › dnf / yum
🎩

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

CommandWhat it does
sudo dnf check-updateList available updates.
sudo dnf upgradeInstall all available updates.
sudo dnf upgrade --securityInstall only security updates.
sudo dnf upgrade packageUpgrade one package.
sudo dnf needs-restarting -rCheck whether a reboot is required (needs dnf-utils).
sudo dnf historyShow past transactions.

Install and remove

CommandWhat it does
sudo dnf install packageInstall a package.
sudo dnf install -y packageInstall without prompting.
sudo dnf install ./file.rpmInstall a local RPM and its dependencies.
sudo dnf remove packageRemove a package.
sudo dnf autoremoveRemove unneeded dependencies.
sudo dnf history undo IDDestructive: Reverse a past transaction by its ID from dnf history.

Search and inspect

CommandWhat it does
dnf search keywordSearch for packages.
dnf info packageShow package details.
dnf list installedList installed packages.
dnf provides /path/to/fileFind which package provides a file or command.
rpm -qa | grep packageCheck whether a package is installed.
rpm -ql packageList the files a package installed.
rpm -qf /path/to/fileFind which installed package owns a file.

Repositories and groups

CommandWhat it does
dnf repolistList enabled repositories.
sudo dnf config-manager --add-repo URLAdd a repository (needs dnf-plugins-core).
sudo dnf group install "Development Tools"Install a package group.
sudo dnf clean allClear cached metadata and packages.
sudo dnf install epel-releaseEnable 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.

More System Administration cheat sheets

⚙️ systemctl📜 journalctl📦 apt👥 Users & groups📊 Processes & performance💽 Disks & storage🔄 rsync⏱️ Cron expressionsAll System Administration cheat sheets →
Copied to clipboard