Created
June 17, 2018 23:46
-
-
Save marlomgirardi/2554e57e892fa6294e0aecb94f10145d to your computer and use it in GitHub Desktop.
Clean up kernel
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
# 1. Get Kernels | |
# 2. Filter installed only | |
# 3. Remove current kernel from list | |
# 4. Purge all kernels on list | |
# 5. Auto-remove | |
# 6. Update grub list | |
sudo dpkg --list 'linux-image*' | \ | |
awk '{ if ($1=="ii") print $2}' | \ | |
grep -v `uname -r` | \ | |
while read -r l; do sudo apt-get -y purge $l </dev/tty;done; \ | |
sudo apt-get autoremove -y; \ | |
sudo update-grub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment