Remove unused Linux kernel related packages

There is a very simple command:

[sourcecode language=”bash”]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[/sourcecode]

From “Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules