Skip to content

Instantly share code, notes, and snippets.

@ipoerner
Last active December 23, 2015 20:29
Show Gist options
  • Save ipoerner/6689794 to your computer and use it in GitHub Desktop.
Save ipoerner/6689794 to your computer and use it in GitHub Desktop.
A small script that uninstalls old kernels from Ubuntu.
#!/bin/sh
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