Skip to content

Instantly share code, notes, and snippets.

@ibrechin
Created February 19, 2019 16:50
Show Gist options
  • Save ibrechin/0dc42f36a22015f3d6608700bc4e440f to your computer and use it in GitHub Desktop.
Save ibrechin/0dc42f36a22015f3d6608700bc4e440f to your computer and use it in GitHub Desktop.
import subprocess
'''
dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv (uname -r)
'''
versions = [
]
packages = [
'linux-headers-{}-generic',
'linux-headers-{}',
'linux-image-extra-{}-generic',
'linux-image-{}-generic',
]
for version in versions:
for package in packages:
subprocess.run(['dpkg', '--purge', package.format(version)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment