Skip to content

Instantly share code, notes, and snippets.

@marlomgirardi
Created June 17, 2018 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marlomgirardi/2554e57e892fa6294e0aecb94f10145d to your computer and use it in GitHub Desktop.
Save marlomgirardi/2554e57e892fa6294e0aecb94f10145d to your computer and use it in GitHub Desktop.
Clean up kernel
# 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