Remove Old Kernels on Fedora

A quick tip to remove old ker­nels from fedora and also lim­it how many ker­nels you want to keep. The main reas­on to remove ker­nels is Disk Space.

Installed Kernels

rpm -q kernel

The above com­mand dis­plays the ker­nel installed on the system.

Remove Old Kernels

## Install yum utils ##
yum install yum-utils
## Package-cleanup keeps the kernels that you want ##
package-cleanup --oldkernels --count=2

Make Number of Installed Kernels Permanent

Edit /etc/yum.conf and set installonly_limit: