After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates.
All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that with a bad kernel, you can't boot your system. So the update process doesn't erase the previous version of linux-image, and the boot loader (GRUB in the case of Ubuntu), gives you the choice at boot time to choose into which kernel you want to boot.
As the list of older images begins to grow, and in order to save room on your disk drive, you may be interested to erase the older versions, and if possible, with only one command line.
The command shell is able to do that. Just open a terminal (Applications > Accessories > Terminal), copy the line below and past it at the prompt of your terminal:
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y remove
And that's it. You will be asked to enter your password for running some command that must be executed as super user.
You will find a detailed explanation of the logic behind this at
http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/
This works on all Ubuntu and Debian systems, but you can adapt it for Fedora or RedHat by changing the command "apt-get -y remove" by its equivalent, which is "yum".
Comments (2)
Author
Commented:Commented:
John