Skip to content

Instantly share code, notes, and snippets.

@polster
Created August 7, 2017 06:42
Show Gist options
  • Save polster/2e8d489f02ae76a70519520876c27f9c to your computer and use it in GitHub Desktop.
Save polster/2e8d489f02ae76a70519520876c27f9c to your computer and use it in GitHub Desktop.
Ubuntu: Cleanup old kernel headers and images
sudo apt-get purge $(for tag in "linux-image" "linux-headers"; do dpkg-query -W -f'${Package}\n' "$tag-[0-9]*.[0-9]*.[0-9]*" | sort -V | awk 'index($0,c){exit} //' c=$(uname -r | cut -d- -f1,2); done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment