1.3 Using DNF From the Command Line

The following table shows examples of some of the common tasks that you can perform by using the dnf command.

Command

Description

dnf repolist

Lists all of the enabled repositories.

dnf list

Lists all of the packages that are available in all enabled repositories and all packages that are installed on your system.

dnf list installed

Lists all of the packages that are installed on your system.

dnf list available

Lists all of the packages that are available to be installed in all enabled repositories.

dnf search string

Searches the package descriptions for the specified string.

dnf provides feature

Finds the name of the package to which the specified file or feature belongs, for example:

dnf provides /etc/dnf/automatic.conf

dnf info package

Displays detailed information about a package, for example:

dnf info dnf-automatic

dnf repoquery -l package

List the files that are contained in a package and are installed when the package is installed, for example:

dnf repoquery -l dnf-automatic

dnf install package

Installs the specified package, including packages on which it depends, for example:

dnf install dnf-automatic

dnf check-update

Checks whether updates exist for packages that are already installed on your system.

dnf upgrade package

Updates the specified package, including packages on which it depends, for example:

dnf upgrade dnf-automatic

DNF also interprets the dnf update package command as synonymous with the upgrade syntax; however, this syntax is considered deprecated.

dnf upgrade

Updates all packages, including packages on which they depend.

DNF also interprets the dnf update package command as synonymous with the upgrade syntax; however, this syntax is considered deprecated.

dnf remove package

Removes the specified package. For example:

dnf remove dnf-automatic

dnf clean all

Removes all cached package downloads and cached headers that contain information about remote packages. Running this command can help to clear problems that are a result of unfinished transactions or out-of-date headers.

dnf help

Displays help about dnf usage.

dnf help command

Displays help about the specified dnf command, for example:

dnf help upgrade

dnf shell

Runs the dnf interactive shell.

See the dnf(8) manual page for more information.

Note

dnf makes no distinction between installing and upgrading a kernel package. dnf always installs a new kernel regardless of whether you specify upgrade or install.