Friday, May 16, 2014

HOWTO: Clean up /boot partition in Ubuntu

Normally, Ubuntu has a few Kernel Updates so, if you installed your Computer with a /boot Partition of 200MB it may get full and it will need some Cleaning Up task.

This one-liner that I've found will delete all the kernels that are not in use and it will just keep the one that is being used at the moment. It works like a charm!

dpkg --get-selections|grep 'linux-image*'|awk '{print $1}'|egrep -v "linux-image-$(uname -r)|linux-image-generic" |while read n;do apt-get -y remove $n;done

I hope it helps!