How to Remove Old Kernels in Fedora 38, RHEL 9

Want to remove old KernelĀ  to free up some disk spaces, or uninstall a certain Kernel package? Here’s how to do the job in Fedora and RHEL Linux.

Unlike Debian/Ubuntu based systems, there seems no graphical applications (please tell me if you know one) to remove old Kernel packages in Fedora. It’s however quite easy to do the job by running few commands in terminal or console.

Step 1: Find out current running Kernel in Fedora/RHEL

First of all, you may find out which Kernel is running now. Removing the current running Kernel may cause issues.

To do so, first search for and launch terminal from the ‘Activities’ overview or start menu depends on your desktop environment.

Open terminal

When terminal opens, run the command below to tell which Kernel your system is running on:

uname -sr

If the running Kernel is the one that you want to remove, then you need to restart machine and choose another Kernel in boot-menu to start.

Step 2: List all installed Kernel in your system

Run the command below in terminal or command console, will tell all the Kernels installed on your system:

rpm -q kernel-core

Step 3: Remove Kernel

To remove a Kernel from your system, just run sudo dnf remove with the package name. For example, remove the Kernel 6.4.10 via command:

sudo dnf remove kernel-core-6.4.10-250.vanilla.fc38.x86_64

Replace kernel-core-6.4.10-250.vanilla.fc38.x86_64 with the Kernel package name you want to remove, according the command output in Step 2.

Without running the command again and again, you may remove multiple Kernel packages, by running single command. And, you may use wildcard * in command.

For example, remove both Kernel 6.4.10 and Kernel 6.5.0 by running single command:

sudo dnf remove kernel-core-6.4.10* kernel-core-6.5.0*

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.