Cheat Sheets

DNF Cheat Sheet: dnf5 on Fedora, dnf on Rocky Linux 10 (PDF)

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.

Original content from computingforgeeks.com - post 190647

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

CommandWhat it does
sudo dnf install -y tmux jqInstall packages and their dependencies without a prompt
sudo dnf remove -y tmuxRemove a package and the dependencies nothing else needs
sudo dnf reinstall -y jqReinstall the same version over itself
sudo dnf download jqSave the .rpm in the current directory (dnf5 also fetched the i686 build)
sudo dnf autoremove --assumenoPreview orphaned dependencies, answer no
sudo dnf install -y epel-releaseRocky/AlmaLinux 10: add the EPEL repository
sudo dnf mark user jqdnf5: mark a package as user installed
sudo dnf mark install jqdnf (Rocky): mark a package as user installed

Search and inspect

CommandWhat it does
dnf search tmuxMatch names and summaries
dnf info tmuxVersion, repo, size, license and description
dnf provides /usr/bin/digFind the package that ships a file
dnf repoquery --requires tmuxList what a package depends on
dnf list --installedEvery installed package (works on both)
dnf list --showduplicates kernelEvery version the enabled repos offer

Updates and security advisories

CommandWhat it does
dnf check-updateList available updates (works on both)
dnf check-upgradeSame list under the dnf5 name
sudo dnf upgradeUpgrade everything
sudo dnf upgrade --security --assumenoPreview only the security updates
dnf advisory list --securitydnf5: list pending security advisories
dnf advisory summarydnf5: count advisories by type and severity
dnf updateinfo list --securitydnf (Rocky), also an alias on dnf5
sudo dnf distro-sync --assumenoPreview syncing every package to the repo version
dnf needs-restarting -rSay whether the last updates need a reboot

History and undo

CommandWhat it does
dnf history listEvery transaction with its ID
dnf history info lastPackages, user and command of the last transaction
sudo dnf history undo last -yReverse the last transaction, dependencies included

Groups

CommandWhat it does
dnf group listGroups with their IDs (dnf5) or names (dnf)
dnf group info development-toolsdnf5: group contents, by ID
sudo dnf group install development-toolsdnf5: install a group by ID
sudo dnf group install "Development Tools"dnf (Rocky): install a group by name
dnf environment listdnf5: environment groups
dnf group list --hiddenInclude hidden groups

Repositories and COPR

CommandWhat it does
dnf repolistEnabled repositories
dnf repolist --allEnabled and disabled repositories
sudo dnf config-manager addrepo --from-repofile=URLdnf5: add a .repo file from a URL
sudo dnf config-manager --add-repo URLdnf (Rocky): add a .repo file from a URL
sudo dnf config-manager setopt docker-ce-stable.enabled=0dnf5: disable a repo through a drop-in
sudo dnf config-manager unsetopt docker-ce-stable.enableddnf5: drop that override again
sudo dnf config-manager --set-enabled crbdnf (Rocky): enable a repo
sudo dnf config-manager --set-disabled crbdnf (Rocky): disable a repo
sudo dnf copr enable -y atim/lazygitAdd a COPR project repository
dnf copr listdnf5: COPR repos on this host
sudo dnf copr disable atim/lazygitKeep the repo file, stop using it
sudo dnf copr remove atim/lazygitDelete the COPR repo file

Version locks

CommandWhat it does
sudo dnf install -y python3-dnf-plugin-versionlockdnf (Rocky): add the versionlock command
sudo dnf versionlock add jqPin a package at its installed version
dnf versionlock listShow active locks
sudo dnf versionlock delete jqRelease the lock

Cache and health checks

CommandWhat it does
sudo dnf clean allDrop cached metadata and packages
sudo dnf makecacheDownload fresh metadata now
dnf checkReport broken dependencies in the rpm database
dnf module listModule streams (none on Fedora 45 or Rocky 10)
cat /etc/dnf/dnf.confMain 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:

ls and rpm output on Fedora 45 showing /usr/bin/dnf and /usr/bin/yum are symlinks to dnf5 and the dnf package is not installed

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:

dnf --version on Rocky Linux 10 printing 4.20.0 with dnf and yum symlinked to dnf-3

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:

TaskFedora (dnf5)Rocky / RHEL 10 (dnf)
Add a repo from a URLconfig-manager addrepo --from-repofile=URLconfig-manager --add-repo URL
Disable a repoconfig-manager setopt REPO.enabled=0config-manager --set-disabled REPO
Mark as user installedmark user PKGmark install PKG
Security advisoriesadvisory list --securityupdateinfo list --security
Install a groupgroup install development-toolsgroup install "Development Tools"
Version lockbuilt in, /etc/dnf/versionlock.tomlplugin, /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:

dnf history info last and dnf history undo last on Fedora 45 removing tmux, jq and the libutempter dependency

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:

  1. packages the transaction installed, removed
  2. dependencies it pulled in, removed with them
  3. packages it removed, installed again
  4. 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:

dnf advisory summary on Fedora 45 showing 10 security, 5 bugfix and 6 enhancement advisories

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

dnf updateinfo list --security on Rocky Linux 10 showing kernel advisory RLSA-2026:95367

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:

  1. dnf advisory list --security or dnf updateinfo list --security
  2. sudo dnf upgrade --security
  3. dnf 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 group install Development Tools failing with No match for argument on Fedora 45

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:

  1. --add-repo is rejected as an unknown argument
  2. addrepo --from-repofile= downloads the .repo file into /etc/yum.repos.d/
  3. setopt writes 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:

dnf5 config-manager on Fedora 45 rejecting --add-repo, then addrepo and setopt writing a repos.override.d drop-in while docker-ce.repo keeps enabled=1

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:

dnf versionlock on Rocky Linux 10 failing with No such command, then locking jq after the plugin is installed

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 URL becomes addrepo --from-repofile=URL
  • --set-disabled REPO becomes setopt REPO.enabled=0
  • --set-enabled REPO becomes setopt 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:

dnf remove dnf on Rocky Linux 10 refused because yum is a protected package

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 toProgramUse
dnf5dnf5 (current Fedora)Subcommands: addrepo, setopt, advisory, mark user, group IDs
dnf-3Python 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.

Keep reading

How to Upgrade Fedora 44 to Fedora 45 (GUI, CLI and Rollback) Fedora How to Upgrade Fedora 44 to Fedora 45 (GUI, CLI and Rollback) Things to Do After Installing Fedora 45 Workstation Fedora Things to Do After Installing Fedora 45 Workstation Enable RPM Fusion and Multimedia Codecs on Fedora 45 / 44 / 43 Fedora Enable RPM Fusion and Multimedia Codecs on Fedora 45 / 44 / 43 Things to Do After Installing Rocky Linux 10 / AlmaLinux 10 AlmaLinux Things to Do After Installing Rocky Linux 10 / AlmaLinux 10 uv Cheat Sheet: Python Package Manager Commands (PDF) Cheat Sheets uv Cheat Sheet: Python Package Manager Commands (PDF) Install Lutris, Heroic and GE-Proton on Fedora 45 / 44 Fedora Install Lutris, Heroic and GE-Proton on Fedora 45 / 44

Leave a Comment

Press ESC to close