Skip to content

Instantly share code, notes, and snippets.

@snoj
Forked from anonymous/cleanboot
Created July 15, 2016 02:12
Show Gist options
  • Save snoj/6999266723c78192816ef056fdcf610f to your computer and use it in GitHub Desktop.
Save snoj/6999266723c78192816ef056fdcf610f 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 -y;
update-grub;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment