Remove old Linux kernels in Ubuntu

As time goes new kernel versions are released. After a kernel update old installed versions are not removed automatically, they are keep in case something goes wrong so you can boot again to a previous version.


But you may end up having lots of old versions you’ll never use. To remove them first you need to find all the installed versions:

$ dpkg -l | grep linux-image | grep -v extra | awk '{print $2}'

Then remove all the unwanted versions using apt-get autoremove:

$ sudo apt-get autoremove linux-image-3.16.0-30-generic linux-image-3.16.0-31-generic linux-image-3.16.0-34-generic

You should probably leave at least the latests 2 versions just in case.


You might also like

Compile and install driver for TP-Link TL-WN725N version 2 in Raspbian
UPDATE: Read this post if you have another version of the kernel and want a script to compile the driver...

New script to compile TP-Link TL-WN725N version 2 lwfinger driver in Raspbian
This script overrides the old "Compile and install driver for TP-Link TL-WN725N version 2 in Raspbian".I've...

Install BCM4360 Wi-Fi drivers in Ubuntu for Macbook Pro 13″ Retina display mid 2014
Ubuntu 14.04 doesn't install by default any driver suitable for the Wi-Fi device in the Macbook Pro 13"...

Fix “Clocksource tsc unstable” kernel message in a virtualized CentOS
If you use CentOS in a virtual environment it may be possible to get hundreds or messages like this from...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.