Removing old linux kernels in Ubuntu.

Removing old linux kernels in Ubuntu.

0203, Dec 09    

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

You might also enjoy