Skip to content

Instantly share code, notes, and snippets.

@cugni
Created March 5, 2016 21:56
Show Gist options
  • Save cugni/38d018f2ce56f78abff1 to your computer and use it in GitHub Desktop.
Save cugni/38d018f2ce56f78abff1 to your computer and use it in GitHub Desktop.
Remove 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