How To Remove Unused Old Kernels On Ubuntu/Debian

The original post can be found here

I’d like to keep a copy here for personal record.

If you update your current Ubuntu or Debian kernel, then the old kernel image will remain installed on your hard drive, despite it is no longer needed or used. Also, if you do a frequent system update, then a heap of kernel files will be taking up much hard disk space without being in use.

In this guide we will help you rid your system of these unused kernel images using a single command from the terminal. The tip is workable for both Ubuntu and Debian-based systems.

Getting Started

1. You can check your current used kernel with this command:

uname -r

2. To find a list of all installed kernels on your system, run this command:

dpkg –list | grep linux-image

3. To remove all unused kernels, run now this command:

sudo aptitude purge ~ilinux-image-\[0-9\]\(\!`uname -r`\)

– If “aptitude” is not installed, then install it with this command:

sudo apt-get install aptitude

4. Update now your Grub2 boot loader with this command:

sudo update-grub2

This entry was posted in Linux, 文摘. Bookmark the permalink.

One Response to How To Remove Unused Old Kernels On Ubuntu/Debian

  1. anthonyvenable110 says:

    Reblogged this on anthonyvenable110.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s