Created
November 3, 2016 00:57
-
-
Save ccammilleri/06817f07577d1308c6964de68560bb47 to your computer and use it in GitHub Desktop.
purge unused kernels in ubuntu to avoid boot partition form filling up
This file contains 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
#! /bin/sh | |
dpkg --get-selections | grep 'linux-image-*' | awk '{print $1}' | egrep -v "linux-image-$(uname -r)|linux-image-generic" | head -n -2 | sed 's/^linux-image-\(.*\)$/\1/' | \ | |
while read n; do | |
echo 'Purging unneeded kernel images and headers for: '$n | |
sudo apt-get --yes purge linux-image-$n #purge images | |
sudo apt-get --yes purge linux-headers-$n #purge headers | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment