Remove Old Kernels on Fedora

A quick tip to remove old ker­nels from fedo­ra and also lim­it how many ker­nels you want to keep. The main rea­son to remove ker­nels is Disk Space.

Installed Kernels

rpm -q kernel

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

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:
installonly_limit=2