Skip to content

Instantly share code, notes, and snippets.

@gMagicScott
Last active August 29, 2015 13:57
Show Gist options
  • Save gMagicScott/9418422 to your computer and use it in GitHub Desktop.
Save gMagicScott/9418422 to your computer and use it in GitHub Desktop.
sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
# Or do this from CRON
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment