How to remove old unused kernels on Fedora/Linux

How to remove old unused kernels on Fedora/Linux

1. Be sure you are notrunning the kernel you plan on removing:

Type uname -r in terminal and it will display the kernel using by your system.

Or You can use the uname -a in terminal to check what kernel is currently used by your server:

2. Then, decide which kernel you want to delete:

Open the terminal and type sudo dnf list installed kernel or you can use rpm -q kernel. It will list all the kernels on the system.

3. Remove old kernels manually

Type this command sudo yum remove <KERNEL NAME> in terminal and then type the kernel version do you want to delete.

4. you can delete the old unused kernel automatically by using this command.

package-cleanup --oldkernels –count=1
 5. You can check that old kernel is deleted or not by using this command.

rpm -q kernel

It will display the list of kernel on your system after deleting the old one.

Leave a Reply