I frequently run into the problem that I don't have enough space on /boot
left. When that happens, I use this answer to free space.
The output of the command shown there gives me not only a bunch of old (and current) images, but also a lot more headers
files. It does not list the current kernel.
foo:~/Desktop $ dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]'
linux-headers-3.16.0-38
linux-headers-3.16.0-39
linux-headers-3.16.0-39-generic
linux-headers-3.19.0-21
linux-headers-3.19.0-21-generic
linux-headers-3.19.0-22
linux-headers-3.19.0-22-generic
linux-headers-3.19.0-23
linux-headers-3.19.0-23-generic
linux-headers-3.19.0-25
linux-headers-3.19.0-25-generic
linux-headers-3.19.0-26
linux-headers-3.19.0-26-generic
linux-image-3.19.0-23-generic
linux-image-3.19.0-25-generic
linux-image-3.19.0-26-generic
I usually remove all but the current kernel and the previous one. However, those headers
are way older. Some are 3.16 while I am now on 3.19.
Do I need those, or can I get rid of them?
How do I remove them?