Remove old kernels in Ubuntu

From The IT Community
Jump to: navigation, search




From time to time, you should clean out your Linux system, especially when that boot partition gets full again.


So, here is how to remove old kernels in Ubuntu:

  • All actions are done in bash, so if you are not already in one, open it.
  • Type
uname -r

and hit enter. This will show you the kernel you are running, this is the one you must not remove.

  • Type
dpkg --list | grep linux-image

to see a list of all linux kernels on your system.

  • Type
sudo apt-get purge linux-image-x.x.x.x-generic

and replace x.x.x.x with the kernel version you want to remove and hit enter.

  • Repeat for all kernel versions except the one you are running.
  • Type
sudo update-grub2 

to update your grub loader.

Done, your Ubuntu is now cleaned of old kernels.

Note: Other Linux distributions (especially those based on Debian) will react similar, but Ubuntu is the one I tried.



Was this article helpful? Then please donate to keep The IT Community alive...

If you found this article helpful please share it, comment and help others by writing your own article.






Translate this page: