Skip to content

Instantly share code, notes, and snippets.

Created October 30, 2014 02:21
Show Gist options
  • Save anonymous/8b43f397cda1b790f7de to your computer and use it in GitHub Desktop.
Save anonymous/8b43f397cda1b790f7de to your computer and use it in GitHub Desktop.
Cleans the /boot folder of all images that is not what is running.
#!/bin/bash
aptitude search linux-image* -F "%c %p" | grep -E "^i.*" | grep -v -E "\slinux-image-generic\s" | grep -v -E `(uname -r | awk '{split($0, a, "-[a-z]"); print a[1];'})` | awk '{ print $2; }' | xargs aptitude remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment