Every now and then i run a cleanup in terminal. Below are the commands I use to do that.
Leave the most recent + the one before, that is a good practice from what I read on this subject.
uname -r #determine which kernel is currently in use, to make sure you are running the latest and not removing an active one.
dpkg --list | grep linux-image #list all existing kernels on the system
sudo apt-get purge linux-image-x.y.zz-aa-generic #type the name of the kernel you want to remove, see the list you generated with the previous command for that
sometimes the directory in which some of the kernel data resides is not automatically removed.
ls /lib/modules #to find which kernels still have a folder there
sudo rm -r /lib/modules/x.x.zz-aa-generic # type the exact name of the folder to be removed. Don't delete the folders for the two kernels you have to keep!
sudo autoremove
sudo autoclean
sudo update-grub # this should run anyway as the last step of the purge-part, but it doesn hurt to do it anyway
Bookmarks