Security for the masses

Skip to: Content | Sidebar | Footer

Ubuntu – Remove old kernels

31 July, 2011 (13:01) | LAMP | By: Blogkeep

Overtime the number of old Kernels on an Ubuntu install grows. On this server the /boot partition is almost full because of them. So it’s time to do a bit of house keeping. This server does not have a UI installed so there’s no easy point and click package manager option.

There is a simple one line command that will do the job:

sudo aptitude purge '~ilinux-image-[0-9].* !'`uname -r`

This command will remove all but the current in use kernel from the system without removing any other package.

If you want to see what will be removed without actually removing anything the command is:

sudo aptitude search '~ilinux-image-[0-9].* !'`uname -r`

Write a comment