Skip to content

Instantly share code, notes, and snippets.

@colegatron
Created August 25, 2016 17:57
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 colegatron/ee55c7f4cdac2a6cf8d9cb50afe204b5 to your computer and use it in GitHub Desktop.
Save colegatron/ee55c7f4cdac2a6cf8d9cb50afe204b5 to your computer and use it in GitHub Desktop.
delete all old kernels
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