Skip to main content

List Installed Linux Kernels and Remove Old ones on Fedora/CentOS

list installed linux kernels

This brief tutorial shows you how to list all installed Linux kernels on Fedora/CentOS and how to remove old ones.

List all installed Linux kernels

Use rpm command with -qa option.

rpm -qa kernel
list installed linux kernels

To check the current running kernel, type this command:

uname -r



Remove Old Kernel

Use dnf remove to remove specific kernels. Example:

sudo dnf remove kernel-4.0.4-301.fc22.x86_64


kernel x86_64 4.0.4-301.fc22 @System 0

Transaction Summary
Remove 1 Package
Is this ok [y/N]: y

Don’t forget to update Grub boot menu:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

CentOS users can install dnf package manager from EPEL repository.

sudo yum install epel-release
sudo yum install dnf

Limit the Number of Kernels on Fedora/CentOS

By default, Fedora and CentOS keep 3 kernels on your system. If you want more old kernels on your system, then edit /etc/yum.conf or /etc/dnf/dnf.conf 

sudo nano /etc/yum.conf
sudo nano /etc/dnf/dnf.conf

Find this line:


Replace 3 by your favorite number. For example, if you like to keep 4 kernels, then change 3 to 4.

That’s it!

Rate this tutorial
[Total: 2 Average: 5]