This quick tip shows you how to remove old kernels from an Ubuntu install.
If you have been using Ubuntu for some time then you must have witnessed a Linux Kernel update. When you update the Linux Kernel, the older version still stays in the system and takes some of the disk storage.
Removing the old kernels is one of the many ways to free disk space in Ubuntu.
Apart from disk space, old Linux kernels also clutter the Grub boot menu (newer Grub is cleaner as it groups all the older Linux Kernels together).
Whatever may be the reason if you want to get rid of the older unused Linux kernel versions, follow this simple tutorial.
Method 1: Remove old kernels from Ubuntu using command line
This is the easiest possible option. All you have to do is to use the command below:
sudo apt autoremove
This apt command removes all the unnecessary packages that are not required anymore. This includes the older Linux kernel versions. In fact, this command is one of the best ways to make free space on Ubuntu.
Method 2: Remove old kernels using Software Center [Not Recommended]
This method was written when the autoremove command didn’t remove Linux kernel versions and you would see a number of Linux kernels in the Grub menu. You don’t need it anymore.
The output should contain something like 3.5.0-16-generic. This number is my current Linux version. This kernel MUST NOT be deleted. In fact, I would suggest you to keep at least one older version in case you may need it.
Now, open Ubuntu Software Center. Search for linux-image. Don’t worry if there are no search results. At the bottom of the panel, click on Show XX technical items:
This will show you the list of Linux Kernels installed in your Ubuntu system. Select any of them and click on Remove to uninstall it.
And that is it. Now update Grub in Ubuntu to refresh it by using the following command in terminal:
Just a reboot here.
I hope this quick tip helped you in removing old kernels from Ubuntu. If you have questions or suggestions, do let me know in the comments.