7 DNF Command References

The following tables show examples of some of the common tasks that you can perform by using the dnf command to manage packages and package groups.

Table 7-1 DNF Commands

Command Description

dnf repolist

Lists all the enabled repositories.

dnf list

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

dnf list installed

Lists all the packages that are installed on the system.

dnf list available

Lists all 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 the 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 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.

Table 7-2 DNF Group Commands

Command Description

dnf group list

Lists Environment Groups, that contain many subgroups; and base groups of packages that are available for installation.

To include hidden groups in the list and all the groups' IDs, add the --hidden -v options.

dnf group info groupname

Displays detailed information about a group. If the group is a parent group, this command lists all subgroups that it contains, alternately the command lists all packages that are in the group.

To include the groups' IDs, use the -v option.

dnf group install groupname

Installs all the packages in a group.

dnf group update groupname

Updates all the packages in a group.

dnf group remove groupname

Removes all the packages in a group.

Table 7-3 DNF Module Commands

Command Syntax Description of Action Additional Information

dnf install package

Installs the specified package.

If a package is provided by a module stream, the dnf command resolves the required module stream and enables it automatically during package installation. In addition, the process is recursive for any package dependencies. Note that if more module streams satisfy the requirement, the default streams are used.

If the package is provided by a module stream that isn't marked as default or isn't enabled, that package isn't recognized until you manually enable the applicable module stream.

dnf module enable module-name:stream

Enables a module or stream.

Use this command when you want to enable a module so that the packages are available to the system, but you don't necessarily want to install the module immediately.

Note that some modules might not define default streams. In this case, you must explicitly specify the stream. If you explicitly specify a stream and an alternate stream is set as the default, the enabled stream overrides the default stream for subsequent install requests.

As an alternative, you can use dnf module switch-to. See the entry in the current table.

dnf install @module-name

Alternatively, you can use:

dnf module install module-name

Installs a module. The @ character is shorthand to indicate that you intend to install a module.

If the module defines a default stream, or you have enabled a particular stream, you don't need to include stream and colon in the command syntax.

Be aware that some modules don't define default streams.

As an alternative, you can use dnf module switch-to. See the entry in the current table.

dnf install @module-name:stream

Alternatively, you can use:

dnf module install module-name:stream

Installs a module by using a specific stream and default profiles.

As an alternative, you can use dnf module switch-to. See the entry in the current table.

dnf install @module-name:stream/profile

Alternatively, you can use:

dnf module install module-name:stream/profile

Installs a module by using a specific stream and profile.

As an alternative, you can use dnf module switch-to. See the entry in the current table.

dnf module info module-name

Displays information about a module.

 

dnf module info --profile module-name

Displays information about the packages that are installed by the profiles of a module using the default stream.

 

dnf module info --profile module-name:stream

Displays information about the packages that are installed by the profiles of a module using a specified stream.

 

dnf module list

Lists all the available modules and displays the module name, stream, profiles, and a summary. Each module and stream is listed on a separate line. Profiles are indicated using comma separated values for each module and stream.

Default values are indicated with the characters [d]. Modules that are enabled are indicated with the characters [e], while those that are disabled are indicated with the characters [x]. Installed modules, streams, and profiles are indicated with the characters [i].

 

dnf module list module-name

Lists the current status of a module.

 

dnf module provides package

Displays information about which modules provide a specified package.

If the package is only available outside of any modules, the command output is empty.

 

dnf module switch-to @module-name:stream/profile

Switch to a module stream. This command also changes the versions of installed packages to those versions provided by the new stream and removes packages from the old stream that are no longer available. The command also updates installed profiles if these are available in the new stream.

This command is more encompassing than dnf module enable command because it both enables modules and runs distrosync on all modular packages in the enabled modules.

The command is also more encompassing than dnf module install because it both installs profiles and runs distrosync on all modular packages in the installed module. However, you must specify a profile with this command because it doesn't use default profiles.

dnf module remove @module-name

Removes the specified module.

Removing an installed module removes all the packages and their dependencies that are installed by the profiles of the enabled module stream.

The modules to be removed must have some profiles already installed.

dnf module remove --all @module-name:stream

Removes all packages from the specified stream.

Note that the command can remove critical packages from the system.

dnf module remove @module-name:stream/profile

Removes packages from the installed profile.

 

dnf module remove @module-name:stream

Removes packages from all installed profiles within the specified stream.

 

dnf module reset @module-name

Resets a module to the initial state so it is no longer enabled or disabled. Consequently, all installed profiles are removed.

Note that the command does not remove packages from the specified module.

dnf module disable @module-name

Disables a module and all its streams.

All related module streams become unavailable. Consequently, all installed profiles are removed.

Note that the command does not remove packages from the specified module.