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. New Grub Customizer with default OS/background/menu colors/resolution support
  2. Manually adding/removing entries to Grub 2 Menu
  3. How to restore Grub 2 after reinstalling Windows XP/Vista/Win7
  4. How to get Add/Remove app back in Ubuntu 9.10(Karmic)
  5. Clean up Ubuntu old grub boot menu after upgrades

    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

    Worked for me as well! no problems with restarting.
    ++
    good work!

    [Reply]

    #4 
    Written By Daan on September 3rd, 2010 @ 2:52 am

    Add a Comment

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