How to Remove Old Linux Kernels

So I was using Ubuntu 11.10 on my virtual machine and I ran into this problem of storage. I had allocated about 8gb of space for my linux machine but as I kept of updating it frequently, it was eating all my precious hard disk space. The problem was that I wasn’t removing my older kernels. So I did some search on Google and found this solution of freeing up space and improving my system’s performance.

Step 1.

Find out your current kernel.

You can do this by opening the terminal and typing the following command

uname -r

this command will give you your current kernel, you should note it down.

mine was 3.0.0-19-generic

Step 2.

Find out all your older kernels by typing the following command in your terminal.

dpkg --list | grep linux-image

you will get a list of all your kernels and you have to remove all other kernels which are lower than your current kernel

Step 3.

Remove your older kernels one by one

sudo apt-get purge linux-image-

Step 4.

When you are done update your grub using the following command

sudo update-grub2

One thought on “How to Remove Old Linux Kernels

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s