Skip to content

Instantly share code, notes, and snippets.

@faleev
Last active July 21, 2018 05:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faleev/5912206 to your computer and use it in GitHub Desktop.
Save faleev/5912206 to your computer and use it in GitHub Desktop.
Delete old kernels on Ubuntu/Debian
dpkg -l | grep ii | awk '{print $2}' | \
grep -E 'linux-(image|headers|ubuntu-modules|restricted-modules)' | \
grep -vE 'linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)' | \
grep -v $(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g') | \
xargs apt-get -y purge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment