ლ(ಠ益ಠლ)

Ubuntu: Remove Unused Kernels

An apt-get upgrade was failing due to the /boot partition being full:

1
2
3
$ dpkg -l 'linux-*' /
| sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' /
| xargs sudo apt-get -y purge

UPDATE - Feb 10 2016

I recently published a follow-up article for systems administrators who are unable to use the above method to remove older kernels.

Comments