MintGuide.org / How to remove old unneeded kernels

How to remove old unneeded kernels

Previously, for these purposes I used the excellent utility KERNELS in the update manager of Linux Mint, I decided to find other solutions.
As always in Linux there are several solutions to the same problem.
In this small article I will show you how you can remove old kernels in Linux Mint in various ways.
Way 1.
You can remove the old core system with a single command in the Terminal. You need to do the following:
sudo apt purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1)
and then run:
sudo apt autoremove && sudo update-grub
Way 2.
You can use the excellent Synaptic package manager. Run the program, click the Search button and enter query - linux-image
How to remove old unneeded kernelsNow we need to sort the list by the first column. To do this, click on the first column, thus first appeared on the list of installed packages that will be highlighted in green.
I recommend to keep the latest and previous version of the kernel, and all the rest can be safely deleted. To do this select the old versions of packages linux-image-X. X. x-generic, linux-headers-X. X. x, linux-headers-X. X. x-generic, clicking with the right mouse button and selecting “Mark for complete removal”, and then click Apply.
The system grub will be updated automatically.
How to remove old unneeded kernelsMay the Force be with you,
Good Luck!!!
5-05-2017, 14:30
Go Back