Run following command to list all the images and headers except the current image and header.
dpkg -l linux-{image,headers}-“[0-9]*” | awk ‘/^ii/{ print $2}’ | grep -v -e `uname -r | cut -f1,2 -d”-“` | grep -e ‘[0-9]’
You can remove listed items by running following commands. (NOTE : Only include above listed versions)
Eg :
sudo apt-get remove linux-image-3.13.0-{34,35,39}-generic
sudo apt-get remove linux-headers-3.13.0-{34,35,39}-generic
sudo apt-get remove linux-headers-3.13.0-{34,35,39}
Remove dependencies.
sudo apt-get autoremove
Dont’ forget to update grub
sudo update-grub