Remove old Kernels in Ubuntu (the right way)

When running Ubuntu and updating systems frequently, there is a high chance to have old kernel-images (no longer needed) still installed in the system.
If these kernels are not removed, precious hard disk space may be occupied (wasted).

This brief tutorial show the one of the ‘right’ ways to find out current running kernel and to remove older ones (not being used by the system).

1. View running kernel’s version:

uname -r

2. Take notes of your current kernel form previous command output and list all installed kernel-images installed in the system:

dpkg --list | grep linux-image

3. Find kernel-image versions to be removed (excluding the previously found running one) and purge it (in the format: linux-image-x.x.x.x-generic, where x.x.x.x indicate the printed version):

apt-get purge linux-image-x.x.x.x-generic

4. Upgrade the Boot-Loader:

update-grub2

Note: a different Boot-Loader could be installed in the system, it has to be ckecked before issuing the command.


Comments are closed.