On Linux distributions you get kernel update and the images of old kernels remain on your machine occupying space. I got a kernel update today:
$ uname -rAfter restart I could see that the image of old kernel was present on the machine:
4.4.0-28-generic
$ dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)I removed the old kernel by using following commands one by one:
ii linux-image-4.4.0-24-generic 4.4.0-24.43 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
sudo dpkg --purge linux-signed-image-4.4.0-24-genericI removed the kernel headers by using following commands one by one:
sudo dpkg --purge linux-image-extra-4.4.0-24-generic
sudo dpkg --purge linux-image-4.4.0-24-generic
sudo dpkg --purge linux-headers-4.4.0-24-genericSince I remove the previous image on every kernel update I had to remove only 4.4.0-24 but if you are doing it first time you may have many images starting from 4.4.0.21
sudo dpkg --purge linux-headers-4.4.0-24