Created
June 1, 2017 09:28
-
-
Save Programie/c33244f689b4d3464f96acb4230140d2 to your computer and use it in GitHub Desktop.
Remove old and unused Linux Kernels on Debian
This file contains hidden or 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/bash | |
| dpkg --list | awk '{print $2}' | grep linux-image | grep -v -e linux-image-amd64 -e "linux-image-`uname -r`" -e `aptitude show linux-image-amd64 | grep '^Depends:' | cut -d : -f 2 | tr -d ' '` | xargs apt-get -y purge |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will remove all installed Linux Kernels excluding the kernel currently in use (linux-image-
uname -r) and excluding the latest kernel (found using "Depends" field of linux-image-amd64 package).