Beyond basic stuff like “dnf install somepackage” or downloading an rpm and using “dnf install my.package.rpm”, this is a running list of useful dnf commands.
List installed packages (similar to rpm -qa):
dnf list installed
List packages with updates available:
dnf check-update
Update everything but the kernel:
dnf update -x kernel*
Find package that provides something:
[lisa@rhel1 ~/]# dnf whatprovides cdrskin Last metadata expiration check: 2:35:57 ago on Fri 12 Aug 2022 11:37:43 AM EDT. cdrskin-1.5.2-2.fc32.x86_64 : Limited cdrecord compatibility wrapper to ease migration to libburn Repo : fedora Matched from: Provide : cdrskin = 1.5.2-2.fc32 cdrskin-1.5.4-2.fc32.x86_64 : Limited cdrecord compatibility wrapper to ease migration to libburn Repo : updates Matched from: Provide : cdrskin = 1.5.4-2.fc32
Package info, including version
[lisa@rhel1 ~/]# dnf info sendmail Last metadata expiration check: 2:37:19 ago on Fri 12 Aug 2022 11:37:43 AM EDT. Available Packages Name : sendmail Version : 8.15.2 Release : 43.fc32 Architecture : x86_64 Size : 730 k Source : sendmail-8.15.2-43.fc32.src.rpm Repository : fedora Summary : A widely used Mail Transport Agent (MTA) URL : http://www.sendmail.org/ License : Sendmail Description : The Sendmail program is a very widely used Mail Transport Agent (MTA). : MTAs send mail from one machine to another. Sendmail is not a client : program, which you use to read your email. Sendmail is a : behind-the-scenes program which actually moves your email over : networks or the Internet to where you want it to go. : : If you ever need to reconfigure Sendmail, you will also need to have : the sendmail-cf package installed. If you need documentation on : Sendmail, you can install the sendmail-doc package.
Show history:
[lisa@rhel1 ~/]# dnf history ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 102 | remove liberation-fonts | 2021-11-28 18:44 | Removed | 3 101 | remove chromedriver | 2021-11-28 18:44 | Removed | 2 100 | remove google-chrome-stable | 2021-11-28 18:44 | Removed | 1 < 99 | install liberation-fonts | 2021-11-28 18:42 | Install | 1 > 98 | install chromedriver | 2021-11-28 18:38 | Install | 2 97 | remove mediainfo | 2021-11-16 13:31 | Removed | 4 96 | install mediainfo | 2021-11-16 13:29 | Install | 4
Which brings up an interesting command — you can undo a history step instead of trying to uninstall the list of things you just installed.
dnf history undo 98 -y