Cleaning out a Full Ubuntu Boot Partition

Regular updates of Ubuntu will tend to fill up the /boot partition. Here is the command to remove all but the current kernel. This works in Ubuntu 12.x, 13,x and 14.x.

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