Last active
August 23, 2017 13:09
-
-
Save awestendorf/2fbe5da79debd344c91c2eebd54c41d4 to your computer and use it in GitHub Desktop.
Removes old kernels from debian/ubuntu
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/bash | |
# Thank you to the person who answered a long-lost post on the internet with this code, | |
# which I have been using successfully for many years | |
sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get purge $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment