Skip to content

Instantly share code, notes, and snippets.

@rudeb0t
Created May 20, 2015 12:44
Show Gist options
  • Save rudeb0t/7463e046f40d7fa28a6f to your computer and use it in GitHub Desktop.
Save rudeb0t/7463e046f40d7fa28a6f to your computer and use it in GitHub Desktop.
Ubuntu is balls: Command line to remove old kernels after upgrading and rebooting
#!/bin/bash
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