Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

DNF Commands: 20 Essential Tasks for Linux Administrators

Learn 20 useful DNF commands for installing, updating, discovering, and troubleshooting packages on RPM-based Linux systems, with notes on DNF4 and DNF5 differences.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

These 20 DNF commands cover package installation, updates, repository and package discovery, cache maintenance, transaction history, and version correction on RPM-based Linux systems. Examples use DNF4-compatible syntax. DNF4 and DNF5 differ in some commands and behavior, so check the manual and help output installed on your distribution before relying on a particular option.

Know which DNF generation your system uses

DNF manages packages on RPM-based distributions, but the installed generation, distribution configuration, plugins, and enabled repositories determine which commands and defaults are available. Fedora Linux 41 made DNF5 the default for new installations and system upgrades; DNF4 may remain installed. DNF5 describes itself as “the new version of DNF, a package manager for RPM-based Linux distributions” in its Package Management Utility documentation.

As an Amazon Associate I earn from qualifying purchases.

The examples below use DNF4-compatible syntax and are not a guarantee that every RPM distribution supports them identically. For local syntax, consult dnf --help or dnf5 --help and the corresponding installed manual. DNF5 has its own command reference and documents CLI changes; for example, legacy commands and configuration-manager behavior may differ. Do not switch casually between DNF4 and DNF5: they can share an RPM database, but their histories are not shared concurrently, and install reasons can appear differently across versions. See the DNF5 migration notes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In commands below, <package> means a package name, <term> a search phrase, <file-or-capability> a file path or capability to look up, <repo-id> a repository identifier, and <transaction-id> an ID shown by dnf history. Replace each placeholder with a real value; do not type the angle brackets.

Install, remove, and update packages

1. Install a package

dnf install <package> installs a package and resolves its dependencies. Before confirming, review the proposed transaction: check the package name, source repository, and every additional package that DNF plans to install or change.

2. Remove a package

dnf remove <package> removes the named package. It can also remove packages that depend on it; with the default clean_requirements_on_remove behavior, unused dependencies may be removed as well. Read the transaction summary before accepting, especially on a server where other services may rely on those packages. The DNF command reference documents removal behavior.

3. Upgrade packages

dnf upgrade updates installed packages to the latest versions DNF can resolve from enabled repositories. Dependency resolution may change more than one package. Review the proposed transaction and repository sources before proceeding; package availability and resolution depend on the repositories and configuration in use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Check for available updates

dnf check-update checks whether updates are available without applying them. Its exit code can signal that updates are available, so automation should not automatically treat every nonzero result as a command failure. Consult the manual for the installed DNF version when scripting around its exit statuses.

5. Synchronize installed versions with repositories

dnf distro-sync aligns installed package versions with the versions available in enabled repositories. Depending on the current system and repository contents, that can upgrade or downgrade packages. Review the full proposed transaction; it is not just a routine update. Avoid enabling development repositories on a production system casually: Fedora’s DNF FAQ warns that mixing Rawhide packages into a stable Fedora release can produce less-tested package combinations.

6. Reinstall a package

dnf reinstall <package> reinstalls a package when it is installed and the same package is available from a configured repository. If the package is unavailable from enabled repositories, DNF cannot fetch it through this command.

7. Downgrade a package

dnf downgrade <package> attempts to move a package to an older version available through configured repositories. The older build must be available, and dependency constraints can prevent the change or affect other packages. Inspect the proposed transaction before confirming.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find packages and inspect repositories

8. List enabled repositories

dnf repolist lists enabled repositories. To include disabled entries, use dnf repolist --all. Repository configuration affects which package builds DNF can see, so verify the enabled sources before installing or changing packages.

9. Search by name or description

dnf search <term> searches package names and descriptions for the supplied term. It is useful when you know what a tool does but not its exact package name.

10. Read package information

dnf info <package> displays available package details such as the summary and description. Use it to check that a search result is the package you intended before installing it.

11. List installed packages

dnf list --installed displays installed packages. DNF list modes can also show available packages; check the installed version’s help or manual for the modes and filters it supports.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

12. Find which package provides a file or capability

dnf provides <file-or-capability> searches for a package that provides a command, file, or capability. For example, use a command or file path as the lookup value when you need to identify which package supplies it. Results depend on package metadata available from configured repositories and installed packages.

13. Query packages in repositories

dnf repoquery <package> queries package information in enabled repositories. It is useful for repository-side discovery; querying the RPM database is the corresponding route when you need information about installed packages. Confirm the installed DNF version’s help for supported query options.

Refresh or clear cached data

14. Refresh repository metadata

dnf makecache creates or refreshes the metadata cache used to search and resolve packages. Run it when metadata may be stale or you need to refresh repository information. Repositories may require network access for the refresh.

15. Clear selected cached data

dnf clean <metadata|packages|all> removes the selected cached metadata, package files, or both. This changes cached data, not the set of installed packages. Clearing caches may mean DNF needs to retrieve metadata or package files again, which can require network access.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Review and correct past transactions

16. List transaction history

dnf history lists recorded package transactions. The list is useful for tracing package changes, but only transactions that were recorded and retained can be inspected. DNF4 and DNF5 histories are not shared concurrently, so choose the correct tool when checking older activity.

17. Inspect a transaction

dnf history info <transaction-id> shows details for a recorded transaction. Review what changed before trying to reverse or otherwise correct it.

18. Attempt to undo a transaction

dnf history undo <transaction-id> asks DNF to perform the inverse of a recorded transaction. It is not a guaranteed system rollback: the undo may fail if current RPM database state, package availability, or dependencies make the inverse impossible. Inspect the transaction and proposed changes before accepting.

19. Remove unneeded dependency packages

dnf autoremove removes packages installed as dependencies that DNF determines are no longer needed. Check the proposed removals carefully before proceeding; package installation reasons and configuration affect what DNF identifies as removable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect or apply security-related updates

20. View advisory information or apply security-filtered updates

dnf updateinfo inspects update advisory information where supported. To apply updates associated with security fixes, a DNF version and repository metadata that support the filter may allow dnf upgrade --security. Advisory filtering depends on relevant metadata and command support; it does not guarantee a complete security audit or establish that all security issues on a system have been addressed. Check the installed version’s documentation and your distribution’s advisory coverage.

Check local configuration before changing a system

The global DNF configuration is commonly in /etc/dnf/dnf.conf, with repository definitions in /etc/yum.repos.d. Distribution defaults can override settings, so inspect local configuration and the installed command’s documentation rather than assuming another distribution behaves the same way. The DNF configuration reference describes these locations and notes that distributions may override some settings.

For any command that installs, removes, upgrades, synchronizes, reinstalls, downgrades, or cleans dependencies, treat DNF’s transaction preview as a decision point: verify affected packages and repositories before confirming.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.