Last active
November 26, 2018 15:56
-
-
Save kurtis318/c4c7b3c3a5983111d23fae6c17b2ff19 to your computer and use it in GitHub Desktop.
Cleanup old kernels on Debian and/or Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I watched one of my virtual machines perfor an apt-get dist-upgrade and I noticed abot 10 kernels being built. | |
This took a quite a while to complete. Here is the solution I found that I don't want to forget. | |
REF: https://www.tecmint.com/remove-old-kernel-in-debian-and-ubuntu/ | |
Show kernels installed: | |
dpkg -l | grep linux-image | awk '{print$2}' | |
Install this package to do this easier: | |
sudo apt install byobu | |
Here is the magic command: | |
sudo purge-old-kernels --keep 3 | |
Here is another way: | |
REF: https://askubuntu.com/questions/2793/how-do-i-remove-old-kernel-versions-to-clean-up-the-boot-menu | |
dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | |
sudo apt-get -y purge <old-kernel-image-from-above> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment