Remove old unused kernels on CentOS LInux

In this step we will list all currently installed kernels:

# rpm -q kernel

Using package-cleanup command which is a part of yum-utils package we can uninstall any number of old kernels automatically. As an example using –oldkernels –count=2 option with package-cleanup command the command will remove all unused kernel while keeping last three most recent kernel versions installed.

Let’s remove all kernels expect the latest currently loaded kernel: Read more