There is a very simple command:
dpkg -l 'linux-<em>' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.</em>)-([^0-9]+)/\1/")"'/d;s/^[^ ]* [^ ]* ([^ ]<em>).</em>/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
From “Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules“