Skip to content

Instantly share code, notes, and snippets.

@rotexdegba
Last active September 9, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rotexdegba/7db389f7946e4808be06934aeca69717 to your computer and use it in GitHub Desktop.
Save rotexdegba/7db389f7946e4808be06934aeca69717 to your computer and use it in GitHub Desktop.
remove old linux kernels in a debian flavored linux distro like ubuntu, mint, etc.
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