Remove old kernels


Simple way to remove all but one kernel:

if [ $(rpm -q kernel | wc -l) -gt 1 ]; then rpm -e $(rpm -q kernel | sed '$d'); fi
if [ $(rpm -q kernel-smp | wc -l) -gt 1 ]; then rpm -e $(rpm -q kernel-smp | sed '$d'); fi
centos  rpm