In Ubuntu 11.10 and newer versions, GRUB2 will display all kernels installed on your system at boot time. If you’re like me, you probably get annoyed with a lengthy list of out of date kernels to scroll through in your GRUB boot menu.
Let’s be real, no one really wants to boot a kernel from last year with bugs and vulnerabilities when you have nice new shiny kernels to choose from. Thankfully, the latest versions of GRUB2 installed in Ubuntu automatically display the latest kernel and hides the older kernels that you may have installed.
But what if you’re not using the latest GRUB?
No problem.
This will remove ALL versions but the current:
sudo apt-get remove –purge $(dpkg -l ‘linux-*’ | sed ‘/^ii/!d;/'”$(uname -r | sed “s/\(.*\)-\([^0-9]\+\)/\1/”)”‘/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d’)
WARNING: Use at your own risk, I am not responsible if you change or break something.
Tweet
Erik
Friday, March 7, 2014
ubuntu linux
No Comment