Just taking Michal's answer a little further. I didn't want to type the kernels to delete everytime so I decided to use files instead.
Write all the current kernels you have on a file.
dpkg --list | egrep -i --color 'linux-image|linux-headers|linux-modules' | awk '{ print $2 }' > kernels.txt
Filter your currently used kernel out of the file using grep.
grep -v $(uname -r) kernels.txt > kernels_to_delete.txt
Verify your current kernel is not present in the delete list. Don't skip this. Ensures you don't mistakenly delete all the kernels.
grep $(uname -r) kernels_to_delete.txt
Delete all the unused kernels in one go.
cat kernels_to_delete.txt | xargs sudo apt purge -y
sudo apt autoremove
help? Which kernels are you asking about? – Pilot6 Jun 24 '20 at 12:31sudo apt autoremove
? Please edit your question and add all the new information. Also indicate if you installed the kernels manually or something special. – user68186 Jun 24 '20 at 12:33autoremove
should remove them. – Pilot6 Jun 24 '20 at 12:48dpkg --list
output includes kernels that have already been removed. The first column will indicate which packages are removed (rc
) and which are installed (ii
). – user535733 Jun 24 '20 at 13:17