David Makin's avatar

Removing old linux kernels in Ubuntu.

As I always forget how to remove the older kernel headers I am posting this here

sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
and a link back to the originating page

comments powered by Disqus