0

Quick Method on How to Remove All Unused Linux Kernel Headers in Ubuntu

I’ve upgraded my Ubuntu recently and i just leave all my old kernels in my machine. Long list of kernels in the GRUB list during boot up of course. :p Although you can use Ailurus to manage all these, i came across this quick method on how to remove all kernels except the current kernel in one go.

Open your terminal CTRL+ALT+T and paste this command:

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

Wait until DONE.

Restart your machine and see your updated GRUB list. Clean!

Thanks Ubuntu Genius!

Andy

Orang Bidayuh. Love Coding, Love Design, Love Bass, Love Music, Love God, Love People. Arsenal, Portugal & Ngap Sayot Fan.

Leave a Reply

Your email address will not be published. Required fields are marked *