Originally posted here:http://www.go2linux.org/clean-linux-...ages-grub-menu by Deven
Just too damn good not to share. Especially seeing as how when I attempted to manually remove the old kernels I ended up spending a few hours getting a kernel back on after deleting all of them.

Code:
#/bin/bash
ls /boot/ | grep vmlinuz | sed 's@vmlinuz-@linux-image-@g' | grep -v `uname -r` > /tmp/kernelList
for I in `cat /tmp/kernelList`
do
aptitude remove $I
done
rm -f /tmp/kernelList 
update-grub #not sure if needed
save as cleanKernels.sh
Execute as root or chmod 755 it.
Code:
sudo bash cleanKernels.sh
Yippee you just freed up some disk space!