LinuxCommandLibrary

dnf

Manage and install software packages

TLDR

Upgrade installed packages to the newest available versions

$ sudo dnf [[up|upgrade]]
copy

Search packages via keywords
$ dnf [[se|search]] [keyword1 keyword2 ...]
copy

Display details about a package
$ dnf [[if|info]] [package]
copy

Install a new package (use --assumeyes to confirm all prompts automatically)
$ sudo dnf [[in|install]] [package1 package2 ...]
copy

Remove a package
$ sudo dnf [[rm|remove]] [package1 package2 ...]
copy

List installed packages
$ dnf [[ls|list]] --installed
copy

Find which packages provide a given command
$ dnf [[wp|provides]] [command]
copy

View all past operations
$ dnf [[hist|history]]
copy

SYNOPSIS

dnf [options] [COMMAND] [package-args]

PARAMETERS

-y, --assumeyes
    Automatically answer yes to prompts

-n, --assumeno
    Automatically answer no to prompts

--best
    Install best (newest) candidate packages

--allowerasing
    Allow package removal to resolve deps

--skip-broken
    Skip packages with broken dependencies

--nogpgcheck
    Disable GPG signature verification

--disableplugin=PLUGIN
    Disable specific plugins

--enablerepo=REPOID
    Enable additional repositories

--disablerepo=REPOID
    Disable repositories by ID

--refresh
    Download fresh metadata before command

-C, --cacheonly
    Use only cached metadata (no network)

--version
    Display DNF version info

-v, --verbose
    Increase verbosity level

-q, --quiet
    Quiet mode, less output

-h, --help
    Show command help

--config=FILE
    Use alternative config file

--setopt=option=value
    Override runtime config options

--releasever=VER
    Set release version for $releasever

--allow-downgrade
    Allow version downgrades

--obsoletes
    Enable obsoletion processing

DESCRIPTION

DNF (Dandified YUM) is a powerful, next-generation package manager for RPM-based Linux distributions including Fedora, RHEL 8+, CentOS Stream, and openSUSE. It succeeds YUM, offering superior dependency resolution via the libsolv library for faster, more accurate package handling even in complex scenarios.

DNF manages software installation, updates, removal, queries, groups, modules, and repositories with features like delta RPMs for bandwidth-efficient updates, automatic cache management, transaction history with undo/redo, and plugin support. It provides progress indicators, colored output, and SELinux integration.

Run with sudo for privileged actions. Configuration resides in /etc/dnf/dnf.conf, repos in /etc/yum.repos.d/. DNF balances usability and power, making it ideal for servers, desktops, and containers.

CAVEATS

Requires root (sudo) for most operations; large repos can be slow/disk-intensive; review transactions carefully to avoid unwanted changes; metadata refreshes use bandwidth.

COMMON SUBCOMMANDS

install package
update [package]
remove, erase package
autoremove
search keyword
list installed|available|upgrades
info package
history [undo ID]
groupinstall group
module enable stream

CONFIG LOCATIONS

/etc/dnf/dnf.conf: global settings (e.g., gpgcheck=1, keepcache=0)
/etc/yum.repos.d/: repo files
/var/cache/dnf/: metadata cache

HISTORY

Developed by Fedora Project starting 2013 using libsolv/hawkey. Default in Fedora 22 (2015); RHEL 8 (2019) adopted it, replacing YUM; evolves with dnf5 for better performance.

SEE ALSO

yum(8), rpm(8), dnf-automatic(8), microdnf(1), hawkey(3)

Copied to clipboard