06-28-2021, 05:45 AM
RHEL and CentOS >= 8 (and Fedora with DNF).
RHEL 8+ use a new package manager (DNF / yum 4, see yum2dnf), which recommend:
Quote:dnf remove $(dnf repoquery --installonly --latest-limit=-2)
There's also yum remove --oldinstallonly to remove old installonly packages, not just kernels (?). (this command requires dnf >= 4.2.17-4 bug #1774670)