One command to remove ubuntu old kernels from grub

This post was written by admin on December 27, 2009
Posted Under: General

If you are running regularly update in your system,the old kernel left behind when ubuntu installs a new linux kernel.The old kernels leave in grub menu,so grub becomes longer and longer.
You can check which kernel you are running by this command:

uname -r

Then use this command to remove unused kernels as well as in grub menu:

sudo aptitude purge ~ilinux-image-.*\(\!`uname -r`\)

If you’d like a GUI,Ubuntu-Tweak is a good choice where you can remove them from Applications->Package Cleaner->Clean Kernel
Install Ubuntu-Tweak,see:http://ubuntuguide.net/installupgrade-latest-ubuntu-tweak-in-ubuntu9-109-048-108-04

Related posts:

  1. Clean up cache,useless file/kernel to free disk space by Ubuntu-Tweak
  2. How to get Add/Remove app back in Ubuntu 9.10(Karmic)
  3. Clean up Ubuntu old grub boot menu after upgrades
  4. Manually adding/removing entries to Grub 2 Menu
  5. How to restore Grub 2 after reinstalling Windows XP/Vista/Win7

    Reader Comments

    the command is “uname -r”. you forgot a “u” in the first code :-)

    [Reply]

    #1 
    Written By kyio on December 28th, 2009 @ 6:50 am

    Only using the command: “uname -a” i achieved the kernel.

    [Reply]

    #2 
    Written By martinn on January 24th, 2010 @ 9:35 am

    Worked for me. Well, restarted fine, made a lot of space on /boot partition.

    10.04, 2.6.32-23 was in use and still is

    [Reply]

    #3 
    Written By alexx on August 10th, 2010 @ 10:35 am

    Add a Comment

    required, use real name
    required, will not be published
    optional, your blog address