When you’re running Ubuntu and updating your system frequently, there is a high chance that older kernels that are no longer needed are still installed on your system. Over time, if these older kernels are not removed, precious hard disk space may be wasted and your system’s performance may suffer.
This brief tutorial will show you how to find out your current running kernel and how to remove older ones that are not being used by your system. This will help you free up some space and may also improve your system’s performance.
Objectives:
- Find out your current running kernel
- Remove older kernels
- Enjoy!
To get started, press Ctrl – Alt – T to open Terminal. When it opens, run the commands below to view your current running kernel.
uname -r
Next, take notes of your current kernel. DO NOT REMOVE THIS!
Next, type the command below to view / list all installed kernels on your system.
dpkg --list | grep linux-image
Next, find all the kernels that which number are lower than your current kernel. When you know which kernel to remove, continue below to remove it.
Finally, run the commands below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
When you’re done, run the commands below to update grub2
sudo update-grub2
That’s all.
原文: