2 ms·
Show HN: Purge old kernels and headers on Linux using apt-get
Hacker News today features an Ubuntu story with sysadmins asking how to purge old kernels and headers by using apt. This is necessary maintenance on some systems because /boot fills up.
Here's how we do it:
apt-get remove --purge 'linux-image-[0-9].*' linux-image-$(uname -r)+
apt-get remove --purge 'linux-headers-[0-9].*' linux-headers-$(uname -r)+
Complete script with comments here; we welcome feedback and also pull requests.
https://github.com/SixArm/sixarm_apt_scripts/blob/master/apt-purge-old-kernels-and-headers
- vientos 10y agoapt-get autoremove does the same and it's built into Ubuntu