Skip to content

Instantly share code, notes, and snippets.

@vitalbh
Created July 30, 2018 17:07
Show Gist options
  • Save vitalbh/2a90fffc62a6b2034926ff026f0f5a52 to your computer and use it in GitHub Desktop.
Save vitalbh/2a90fffc62a6b2034926ff026f0f5a52 to your computer and use it in GitHub Desktop.
remove old kernels
dpkg -l linux-image-\* | grep ^ii
kernelver=$(uname -r | sed -r 's/-[a-z]+//')
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver
#purge
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment