Created
February 3, 2017 13:49
-
-
Save WillPlatnick/2c25ff5907943fd65908ba82d5b7a3d2 to your computer and use it in GitHub Desktop.
Clean up old kernels in 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
#Remove kernel packages that have been removed but not purged | |
dpkg -l | grep linux-image | grep "^rc" | cut -d' ' -f3 | xargs apt-get --purge remove -y | |
# Remove all kernel images except the current running one | |
sudo apt-get remove $(dpkg -l *linux-image-[0-9]* | grep ii | grep -v $(uname -r) | awk '{print $2}') | |
# Remove old dkms that are left due to bug; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717584 | |
rm /boot/*.old-dkms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment