Skip to content

dnf command

Install, update and remove packages on Fedora, RHEL, Rocky and AlmaLinux.

On this page

Syntax

dnf [options] command [package…]

Provided by the dnf package. Run man dnf for the full manual.

Common options

OptionWhat it does
installInstall packages
removeRemove packages
upgradeUpgrade packages
check-updateList available updates
searchSearch packages
infoPackage details
list installedInstalled packages
provides FILEWhich package provides a file
historyPast transactions
-yAnswer yes

Examples

  1. Install a package

    sudo dnf install nginx
  2. Upgrade everything

    sudo dnf upgrade -y
  3. Check for updates

    dnf check-update
  4. Remove a package

    sudo dnf remove httpd
  5. Search

    dnf search redis
  6. Which package provides a command

    dnf provides /usr/bin/dig
  7. List installed packages

    dnf list installed
  8. Enable EPEL on RHEL-compatible systems

    sudo dnf install epel-release
  9. Undo the last transaction

    sudo dnf history undo last

Tips

  • yum is a link to dnf on current RHEL, Rocky and AlmaLinux.

dnf guides

← All Linux commands · Suggest a fix

Back to top