Skip to content

Instantly share code, notes, and snippets.

@vordan
Last active April 6, 2017 09:37
Show Gist options
  • Save vordan/059af461553e9fd16d653f8b28b94e71 to your computer and use it in GitHub Desktop.
Save vordan/059af461553e9fd16d653f8b28b94e71 to your computer and use it in GitHub Desktop.
Remove old kernel versions to clean up the boot menu
#!/bin/bash
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'|grep -E "(image|headers)" | xargs sudo apt-get -y purge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment