Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Remove All Unused Ubuntu Kernel Images, Headers, and Modules

DZone's Guide to

Remove All Unused Ubuntu Kernel Images, Headers, and Modules

· DevOps Zone
Free Resource

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

Seeing that my linux box is running low on free space I decided to remove all unused Linux kernel images on my Ubuntu 10.04 system.

For some unknown reason Ubuntu Tweak refused to install properly so I decided to go a different way and used the command from this blog article.

The command mentioned in the blog is:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge 

If you don't understand what this command does I recommend to dig into the topic. I must admit it is a little bit complex, but the command is working well.

Use it at your own risk!

Now my system is cleaned up and still boots the correct and latest kernel. All other kernel images, headers and modules are completely removed.

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

Topics:

Published at DZone with permission of Ralf Quebbemann, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}