Typing dnf on Fedora and on Rocky Linux 10 doesn’t run the same program. Fedora’s dnf is a symlink to dnf5, the C++ rewrite, while Rocky, RHEL and AlmaLinux 10 still ship the Python dnf that came before it. Most daily commands look identical, and that is exactly why the differences catch you. A repo command copied from a RHEL runbook fails on Fedora with “Unknown argument”, and a group install fails on the name you have used for years.
This dnf cheat sheet puts both programs side by side. The tables come first for copying, then a syntax map of the commands that changed, then the errors each version prints when you use the other one’s syntax. Everything below was run on Fedora 45 (dnf5 5.4.6) and Rocky Linux 10.2 (dnf 4.20) in November 2026.
DNF Cheat Sheet (Quick Reference)
Commands that change the system need sudo, and the read-only ones don’t. Where the two programs disagree, the row says which one it’s for. Everything without a label works the same on Fedora’s dnf5 and on Rocky’s dnf.
Install and remove
| Command | What it does |
|---|---|
sudo dnf install -y tmux jq | Install packages and their dependencies without a prompt |
sudo dnf remove -y tmux | Remove a package and the dependencies nothing else needs |
sudo dnf reinstall -y jq | Reinstall the same version over itself |
sudo dnf download jq | Save the .rpm in the current directory (dnf5 also fetched the i686 build) |
sudo dnf autoremove --assumeno | Preview orphaned dependencies, answer no |
sudo dnf install -y epel-release | Rocky/AlmaLinux 10: add the EPEL repository |
sudo dnf mark user jq | dnf5: mark a package as user installed |
sudo dnf mark install jq | dnf (Rocky): mark a package as user installed |
Search and inspect
| Command | What it does |
|---|---|
dnf search tmux | Match names and summaries |
dnf info tmux | Version, repo, size, license and description |
dnf provides /usr/bin/dig | Find the package that ships a file |
dnf repoquery --requires tmux | List what a package depends on |
dnf list --installed | Every installed package (works on both) |
dnf list --showduplicates kernel | Every version the enabled repos offer |
Updates and security advisories
| Command | What it does |
|---|---|
dnf check-update | List available updates (works on both) |
dnf check-upgrade | Same list under the dnf5 name |
sudo dnf upgrade | Upgrade everything |
sudo dnf upgrade --security --assumeno | Preview only the security updates |
dnf advisory list --security | dnf5: list pending security advisories |
dnf advisory summary | dnf5: count advisories by type and severity |
dnf updateinfo list --security | dnf (Rocky), also an alias on dnf5 |
sudo dnf distro-sync --assumeno | Preview syncing every package to the repo version |
dnf needs-restarting -r | Say whether the last updates need a reboot |
History and undo
| Command | What it does |
|---|---|
dnf history list | Every transaction with its ID |
dnf history info last | Packages, user and command of the last transaction |
sudo dnf history undo last -y | Reverse the last transaction, dependencies included |
Groups
| Command | What it does |
|---|---|
dnf group list | Groups with their IDs (dnf5) or names (dnf) |
dnf group info development-tools | dnf5: group contents, by ID |
sudo dnf group install development-tools | dnf5: install a group by ID |
sudo dnf group install "Development Tools" | dnf (Rocky): install a group by name |
dnf environment list | dnf5: environment groups |
dnf group list --hidden | Include hidden groups |
Repositories and COPR
| Command | What it does |
|---|---|
dnf repolist | Enabled repositories |
dnf repolist --all | Enabled and disabled repositories |
sudo dnf config-manager addrepo --from-repofile=URL | dnf5: add a .repo file from a URL |
sudo dnf config-manager --add-repo URL | dnf (Rocky): add a .repo file from a URL |
sudo dnf config-manager setopt docker-ce-stable.enabled=0 | dnf5: disable a repo through a drop-in |
sudo dnf config-manager unsetopt docker-ce-stable.enabled | dnf5: drop that override again |
sudo dnf config-manager --set-enabled crb | dnf (Rocky): enable a repo |
sudo dnf config-manager --set-disabled crb | dnf (Rocky): disable a repo |
sudo dnf copr enable -y atim/lazygit | Add a COPR project repository |
dnf copr list | dnf5: COPR repos on this host |
sudo dnf copr disable atim/lazygit | Keep the repo file, stop using it |
sudo dnf copr remove atim/lazygit | Delete the COPR repo file |
Version locks
| Command | What it does |
|---|---|
sudo dnf install -y python3-dnf-plugin-versionlock | dnf (Rocky): add the versionlock command |
sudo dnf versionlock add jq | Pin a package at its installed version |
dnf versionlock list | Show active locks |
sudo dnf versionlock delete jq | Release the lock |
Cache and health checks
| Command | What it does |
|---|---|
sudo dnf clean all | Drop cached metadata and packages |
sudo dnf makecache | Download fresh metadata now |
dnf check | Report broken dependencies in the rpm database |
dnf module list | Module streams (none on Fedora 45 or Rocky 10) |
cat /etc/dnf/dnf.conf | Main configuration file |
That is the copy and paste layer. The rest of the page shows what these commands printed on the two lab machines, starting with the rows that differ, because those are the ones that fail when a runbook moves between distros.
Fedora’s dnf Is dnf5
Fedora doesn’t install the old dnf package at all. Both dnf and yum are four-byte symlinks to dnf5, and the plugin commands you’d expect from dnf-plugins-core come from dnf5-plugins instead:
ls -l /usr/bin/dnf /usr/bin/yum
rpm -q dnf dnf5 dnf-plugins-core dnf5-plugins python3-dnf-plugin-versionlock
On the Fedora 45 Cloud image the dnf and versionlock packages are missing, and dnf5 plus its plugins are present. That is not a broken install, because dnf5 replaced the old package outright rather than living beside it. So any guide that tells you to install dnf-plugins-core on Fedora is describing a release you are not running:

Run the same two checks on Rocky Linux 10 and the links point to dnf-3, the Python entry point. dnf --version also prints the version on its own first line, then the dnf and rpm builds:

So the version split follows the distro, not the command you type. That matters most in automation, because an Ansible task or a shell script does not know which dnf it is talking to, so a line that works on your Fedora laptop can fail on every RHEL server in the fleet. These are the rows where the program changes what you have to write, each one tested on both machines:
| Task | Fedora (dnf5) | Rocky / RHEL 10 (dnf) |
|---|---|---|
| Add a repo from a URL | config-manager addrepo --from-repofile=URL | config-manager --add-repo URL |
| Disable a repo | config-manager setopt REPO.enabled=0 | config-manager --set-disabled REPO |
| Mark as user installed | mark user PKG | mark install PKG |
| Security advisories | advisory list --security | updateinfo list --security |
| Install a group | group install development-tools | group install "Development Tools" |
| Version lock | built in, /etc/dnf/versionlock.toml | plugin, /etc/dnf/plugins/versionlock.list |
| Module streams | “no module streams exist” | deprecation warning, empty list |
The aliases mostly run one way. dnf5 accepts updateinfo and check-update as old names, but Rocky’s dnf doesn’t accept the new config-manager subcommands, as the errors section shows. The upstream changes between DNF and DNF5 page lists the full set of renames.
History Undo Reverses Whole Transactions
A common belief is that history undo removes the packages you named. It doesn’t. It replays the opposite of the whole transaction, so dependencies that came in with it leave with it. Look at the transaction first, then undo it:
dnf history info last
sudo dnf history undo last -y
On Fedora the install of tmux and jq pulled in libutempter as a dependency. The undo took all three out, listing the dependency under its own “Removing unused dependencies” heading:

The same command on Rocky removed only tmux, because jq was already on that image and the install transaction never touched it. So what does undo actually reverse? In order:
- packages the transaction installed, removed
- dependencies it pulled in, removed with them
- packages it removed, installed again
- anything you named that was already installed, left alone
The two programs also format the history list differently, so a script that parses dnf history list on one host won’t parse it on the other. Rocky prints a pipe table:
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
4 | install -y tmux jq | 2026-11-14 03:44 | Install | 1
3 | -y -q upgrade | 2026-11-04 22:42 | I, U | 139 E<
2 | --config /kiwi_dnf4.conf | 2026-05-26 00:16 | Install | 267 >E
1 | --config /builddir/resul | 2026-05-26 00:16 | Install | 177 EE
Fedora’s dnf5 drops the pipes and leaves the Action(s) column empty, so use history info when you need to know what a transaction actually did. On a shared host, read that output before every undo, because the packages it lists are exactly the ones that will change.
Security Updates Come From Advisories
--security doesn’t guess which packages are security fixes. It reads the advisory metadata the distro publishes with each repo, so the answer is only as good as that metadata. On Fedora the summary command is advisory:
dnf advisory summary
The Fedora 45 VM had ten security advisories pending, five of them rated Important. A zero in the Critical row does not make the host safe to skip, because Important was the highest rating anything on this host carried. So read the top nonzero row as the one that drives your patch window:

Rocky uses updateinfo, and its advisories carry Rocky’s own RLSA IDs. Here a single Important kernel advisory was waiting:

Preview the security upgrade with --assumeno before you commit to it, because it can be bigger than the advisory count suggests:
sudo dnf upgrade --security --assumeno
On Fedora those ten advisories turned into a new kernel plus 13 upgraded packages:
Transaction Summary:
Installing: 2 packages
Upgrading: 13 packages
Replacing: 13 packages
Total size of inbound packages is 90 MiB. Need to download 90 MiB.
After this operation, 155 MiB extra will be used (install 212 MiB, remove 58 MiB).
Operation aborted by the user.
Only ten advisories, yet 15 packages and 90 MiB, because one advisory can cover several binary packages and the kernel update installs a new kernel-core beside the running one instead of replacing it. A kernel in that list means a reboot, and dnf needs-restarting -r tells you when one is due. It comes from dnf5-plugins on Fedora and dnf-plugins-core on Rocky, both preinstalled, so neither machine needed an extra package. On dnf5 the -r flag is kept only for compatibility, since the reboot check is its default. Before any update it printed the same line on both: “No core libraries or services have been updated since boot-up.”
For a patch window you can run the same three steps on either distro, swapping only the advisory command:
dnf advisory list --securityordnf updateinfo list --securitysudo dnf upgrade --securitydnf needs-restarting -r, then reboot if it asks
The order matters, because the list in step one is your record of what the window was supposed to fix.
dnf5 Matches Groups by ID
Everyone types dnf group install "Development Tools" from memory. On Rocky it still works. On Fedora’s dnf5 the quoted name fails before anything is downloaded:

dnf5 resolves a group argument against group IDs, and the display name is only a label. dnf group list prints the ID in the first column, so you can look it up in seconds instead of guessing. The ID for this group is development-tools:
sudo dnf group install development-tools --assumeno
With the ID the transaction resolves, and the preview shows what the group really costs. The --assumeno flag answers no at the prompt, so nothing is downloaded or installed. That makes it a safe way to measure a group before you commit a build host to it:
Transaction Summary:
Installing: 186 packages
Total size of inbound packages is 313 MiB. Need to download 313 MiB.
After this operation, 1 GiB extra will be used (install 1 GiB, remove 0 B).
Operation aborted by the user.
The same group is not the same size across distros. Rocky’s “Development Tools” wanted 262 packages and a 197 M download, while Fedora’s wanted 186 packages and 313 MiB, because each distro defines the group’s contents in its own comps file. So don’t size a build host on one distro’s numbers and deploy it on the other. Run the install with --assumeno on the target first and read the summary:
- package count, for the length of the transaction
- download size, for mirror bandwidth
- installed size, for the disk you give the VM
Nothing is installed by a preview, and dnf5 even lets you run it without root. That means you can size a group from an unprivileged account on the target before you ask for sudo.
Repo Changes Land in Drop-in Files
The dnf5 config-manager uses subcommands instead of flags, and it never edits an existing repo file. What happens when you run the RHEL syntax, then the dnf5 syntax, then disable the repo:
--add-repois rejected as an unknown argumentaddrepo --from-repofile=downloads the .repo file into/etc/yum.repos.d/setoptwrites the change to/etc/dnf/repos.override.d/99-config_manager.repo
The capture runs all three steps in one session, then prints the override file and the repo file. The original docker-ce.repo still says enabled=1, because setopt never touched it:

Notice updates-testing in the same override file, too. Those entries mean grepping enabled= in the .repo files no longer tells you which repos are on, because the override wins over the file. Trust dnf repolist --all instead, since it reads every layer the way dnf does. To drop the override and fall back to the repo file’s own value, use unsetopt:
sudo dnf config-manager unsetopt docker-ce-stable.enabled
Fedora’s own repo files have also moved. The fedora, updates, updates-testing and openh264 definitions live in /usr/share/dnf5/repos.d/, which is why /etc/yum.repos.d/ held only docker-ce.repo on the lab VM. Third-party repos such as RPM Fusion for multimedia codecs still land in /etc/yum.repos.d/.
On Rocky the old flags are the only form. Enabling CRB, which many EPEL packages depend on, is one line:
sudo dnf config-manager --set-enabled crb
dnf repolist | grep -i crb
Rocky’s config-manager edits the existing .repo file in place: the [crb] section of rocky.repo flipped to enabled=1 and back, which is the opposite of what dnf5 does. So on Rocky the file itself is the source of truth, and a grep for enabled= still works there. The repolist confirms the repo is live:
crb Rocky Linux 10 - CRB
Leave CRB enabled for as long as packages from it stay installed, because --set-disabled crb also stops their updates.
COPR works on both
COPR is the one repo workflow that reads the same on both distros. The atim/lazygit project installed lazygit on Fedora 45 and on Rocky 10 with identical commands:
sudo dnf copr enable -y atim/lazygit
sudo dnf install -y lazygit
lazygit --version
The first install imports the project’s OpenPGP key, so expect a key prompt on any run without -y. The enable step also prints a warning that COPR packages are not held to Fedora’s quality or security level. The version check confirms the binary runs:
commit=, build date=, build source=unknown, version=0.47.2, os=linux, arch=amd64, git version=2.56.0
Look closely at the Fedora install transaction: it listed lazygit x86_64 0:0.47.2-1.fc43, a Fedora 43 build. COPR serves whatever chroots the owner builds, so a project can lag behind the current Fedora. Check the release tag before you trust a COPR package on a fresh Fedora. When you’re done with the project, copr remove deletes the repo file rather than just disabling it:
sudo dnf copr remove atim/lazygit
dnf5 names the file it removed, which is useful when you are cleaning up a host somebody else set up. The file name carries the hub, the owner and the project, so you can match it against dnf copr list before and after:
Repo file /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:atim:lazygit.repo successfully removed
Rocky prints a shorter “Repository successfully removed.” Neither command removes the package, so run sudo dnf remove lazygit as well if you want it gone.
Versionlock Lives in Different Places
On Fedora, versionlock is part of dnf5 and needs no install. It stores locks as TOML:
sudo dnf versionlock add jq
cat /etc/dnf/versionlock.toml
Each lock is a package name plus an EVR condition with an equals comparator. Because the condition is an exact version, any upgrade that would change jq is filtered out until you delete the lock. No newer jq existed on test day, so the lab could not show a blocked upgrade. The file looked like this:
version = "1.0"
[[packages]]
name = "jq"
comment = "Added by 'versionlock add' command on 2026-11-14 03:43:45"
[[packages.conditions]]
key = "evr"
comparator = "="
value = "1.8.2-5.fc45"
Rocky doesn’t have the command until you install python3-dnf-plugin-versionlock. The capture below is the same add run before and after that install, and the lock file it writes is a plain list of NEVRA globs:

The two files are not interchangeable, so a config management role that copies versionlock.list to Fedora hosts does nothing there, and the package keeps upgrading while you believe it is pinned. Where does each lock live?
- Fedora:
/etc/dnf/versionlock.toml, exact EVR - Rocky:
/etc/dnf/plugins/versionlock.list, NEVRA glob
Manage locks with the command on each host rather than shipping the file, unless your role templates both formats. Kernel pinning and the exclude rules are covered in the dnf versionlock guide for Fedora.
Errors That Mean the Wrong dnf
Most dnf errors you’ll hit after moving between Fedora and RHEL aren’t broken systems. They’re the other program’s syntax. Each message below came from the lab machines.
Unknown argument “–add-repo” for command “config-manager”
You are on dnf5 with RHEL syntax, and --set-disabled fails with the same message. dnf5 turned every config-manager flag into a subcommand, so swap them one for one:
--add-repo URLbecomesaddrepo --from-repofile=URL--set-disabled REPObecomessetopt REPO.enabled=0--set-enabled REPObecomessetopt REPO.enabled=1
The first two were run on the lab VM; the third is the same option with the opposite value.
Command line error: one of the following arguments is required
The reverse case. Rocky’s dnf saw config-manager setopt and printed this, followed by a long usage block:
Command line error: one of the following arguments is required: --save --add-repo --dump --dump-variables --set-enabled --enable --set-disabled --disable
Switch to --set-disabled REPO on RHEL family hosts.
No such command: versionlock
Rocky without the plugin. The error even names the fix: dnf install 'dnf-command(versionlock)', which resolves to python3-dnf-plugin-versionlock.
Unknown argument “install” for command “mark”
dnf5 renamed mark install to mark user. If the package already has that reason, dnf5 says so and does nothing.
No match for argument
Both versions print this for a package or group that doesn’t exist in the enabled repos. On dnf5 it’s also what a group name produces, so try the group ID before you go looking for a missing repo. dnf5 suggests --skip-unavailable, which only helps when the other packages on the line should install anyway.
No matches found (dnf list installed)
This one is silent, which makes it the most dangerous. On Rocky, dnf list installed | wc -l counted 446 lines. On Fedora the same pipeline printed “No matches found.” and a count of 0, because dnf5 reads installed as a package name, not a filter. A script that checks that count would decide the host is empty, so use dnf list --installed, which works on both.
This command has to be run with superuser privileges
That’s Rocky’s wording for a missing sudo. dnf5 says “The requested operation requires superuser privileges” and adds that --assumeno or --downloadonly run without root, which is handy for a preview from an unprivileged account.
broken dependencies for the following protected packages: yum
dnf protects itself. On Rocky, removing dnf would break yum, which is protected, so the transaction is refused:

On Fedora the same command prints “No packages to remove for argument: dnf”, because the dnf package isn’t installed in the first place. Don’t reach for --skip-broken here: the refusal is the package manager keeping itself alive.
Check Which dnf a Host Runs
Before you paste a runbook into a host you didn’t build, ask it which program answers to dnf. The release file tells you the distro, but the symlink tells you the program, and the program is what parses your flags. One ls -l /usr/bin/dnf settles it, and the target decides the syntax:
| /usr/bin/dnf points to | Program | Use |
|---|---|---|
dnf5 | dnf5 (current Fedora) | Subcommands: addrepo, setopt, advisory, mark user, group IDs |
dnf-3 | Python dnf (RHEL, Rocky, AlmaLinux 10) | Flags: --add-repo, --set-enabled, updateinfo, mark install, group names |
Fedora 44 already runs dnf5, so the Fedora 44 to 45 upgrade doesn’t change the syntax you use. For dnf5 only, with more Fedora edge cases, the DNF5 cheatsheet for Fedora goes deeper. When you need to query the rpm database directly, the rpm cheat sheet covers it, and the Debian side of the house has its own apt cheat sheet.
More printable references for Linux and DevOps tools live on the cheat sheets page.