Created
October 6, 2014 17:55
-
-
Save mamrehn/59a7a6431c18d76569fc to your computer and use it in GitHub Desktop.
Frequent Linux (kernel) updates clutter the free disc space left on your hard drive. If everything works with the new version, delete the old ones with this small script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After this run 1,071 MB of disk space were freed on the system hdd.
Code first seen on the ubuntugenius blog.