The “dnf” command is a package management utility used in Fedora-based Linux distributions, including Fedora itself. It is used to manage software packages, including installation, removal, upgrading, and searching for packages in the distribution’s repositories.
Here is the basic syntax of the “dnf” command:
sudo dnf [options] [command]
Here’s a practical example of how to use the “dnf” command:
- Update the package lists:
sudo dnf update
This command updates the local package lists, retrieving the latest information about available packages from the repositories.
$ sudo dnf update
In this example, the “dnf” command is used to update the package lists. It synchronizes the package information on your system with the repositories.
- Install a package:
sudo dnf install package_name
Replace “package_name” with the name of the package you want to install. This command downloads and installs the specified package and any necessary dependencies.
$ sudo dnf install firefox
In this example, the “dnf” command is used to install the “firefox” package. It retrieves the package from the repositories and installs it on the system.
- Remove a package:
sudo dnf remove package_name
Replace “package_name” with the name of the package you want to remove. This command removes the specified package from the system.
$ sudo dnf remove firefox
In this example, the “dnf” command is used to remove the “firefox” package from the system. It removes the package from the system, along with any dependencies that are no longer required.
- Upgrade installed packages:
sudo dnf upgrade
This command upgrades all installed packages to their latest versions. It downloads and installs updated versions of the packages from the repositories.
$ sudo dnf upgrade
In this example, the “dnf” command is used to upgrade all installed packages on the system. It retrieves and installs the latest versions of the packages.
The “dnf” command provides a robust and user-friendly package management solution in Fedora-based Linux distributions. It simplifies the process of managing software packages, ensuring that your system is up to date and equipped with the desired software.