Example:15) Show all installed as well as available packages

To get list of all packages i.e. installed as well as available, run the following command

Example:16) Enable repo for installation

To use a particular repository for installing a package, run

[[email protected] ~]$ sudo dnf install --enablerepo=epel mysql Extra Packages for Enterprise Linux 7 - x86_64 3.9 MB/s | 13 MB 00:03 Last metadata expiration check: 0:00:07 ago on Thu 12 Oct 2017 09:53:00 AM IST. Dependencies resolved. =========================================================================================== Package Arch Version Repository Size =========================================================================================== Installing: mariadb x86_64 3:10.1.26-2.fc26 updates 6.4 M Installing dependencies: mariadb-common x86_64 3:10.1.26-2.fc26 updates 100 k mariadb-config x86_64 3:10.1.26-2.fc26 updates 33 k mariadb-libs x86_64 3:10.1.26-2.fc26 updates 663 k Transaction Summary ============================================================================================ Total download size: 7.2 M Installed size: 44 M Is this ok [y/N]: y

Example:17) Check which package provides the required function

If we wants to know which package is responsible for getting a particular functionality, like we need to know package name that is associated with ‘crontab’ or with some other command, than we can use the dnf command ‘provides‘ option in the following manner,

[[email protected] ~]$ sudo dnf provides crontab Last metadata expiration check: 0:02:44 ago on Thu 12 Oct 2017 09:53:00 AM IST. cronie-1.5.1-5.fc26.x86_64 : Cron daemon for executing programs at set times Repo : @System cronie-1.5.1-5.fc26.x86_64 : Cron daemon for executing programs at set times Repo : fedora [[email protected] ~]$

Same can be done against a file, we can also use the same command with a file location to get the package name with which the file is associated,

[[email protected]]$ sudo dnf provides /var/www/html

Example:18) View package information

To get details of a specific package, execute

[[email protected] ~]$ dnf info cronie Last metadata expiration check: 0:00:20 ago on Thu 12 Oct 2017 09:56:28 AM IST. Installed Packages Name : cronie Version : 1.5.1 Release : 5.fc26 Arch : x86_64 Size : 236 k Source : cronie-1.5.1-5.fc26.src.rpm Repo : @System From repo : anaconda Summary : Cron daemon for executing programs at set times URL : https://fedorahosted.org/cronie License : MIT and BSD and ISC and GPLv2+ Description : Cronie contains the standard UNIX daemon crond that runs specified programs at : scheduled times and related tools. It is a fork of the original vixie-cron and : has security and configuration enhancements like the ability to use pam and : SELinux. [[email protected] ~]$

Example:19) Building a cache

Though the cache is built automatically over time but we also have an option to manually build the cache, so that the future actions are fast & completed quickly. To create a cache manually, execute

[[email protected] ~]$ sudo time dnf makecache Last metadata expiration check: 0:04:41 ago on Thu 12 Oct 2017 09:53:00 AM IST. Metadata cache created. 0.86user 0.12system 0:01.04elapsed 95%CPU (0avgtext+0avgdata 106872maxresident)k 0inputs+1192outputs (0major+39606minor)pagefaults 0swaps [[email protected] ~]$

Example:20) Delete a cache

To delete all the dnf cached data, execute the following commands

[[email protected] ~]$ sudo dnf clean all 34 files removed [[email protected] ~]$

Example:21) Check the transaction history

To check all the transactions that have been done using DNF command, run the following commands

[[email protected] ~]$ sudo dnf history