Linux Mint / Ubuntu remove all old kernels

While installing the new VMware guest program on my Xubuntu VM I noticed the installer working on a large number of old and kernel files. I tried to get the number of old kernels and remove them by script.

There is a nice script to automatically remove old kernels and retain the two latest kernels: purge-old-kernels

After installing you can call the script

Additional Information

To see old kernel files:

To see the currently used kernel:

Here is a screenshot of how it actually works:

purge old kernels

Updated: 29-11-2017

(164 Posts)

20 years of coding and working as software engineer but I am still eager to learn more. I am very passionate when it comes to open source, Linux and Java. But I made my peace with Windows long ago to fully enjoy my PC gaming hobby. I have a soft spot for 90s electronic music and Babylon 5. In the evenings you will find me roaming the endless space in Warframe (IGN k05h).