Ubuntu Kernel Cleanup#
Remove old Linux kernel versions on Ubuntu. This only keeps the currently used kernel and removes all the others. You have been warned. 🤞😁
df /boot/
dpkg --get-selections | cut -f1 | egrep '^linux-image-.+' | grep -v $(uname -r) | egrep -v 'linux-image-(generic|amd64)' > /tmp/old_kernels
less /tmp/old_kernels # review
sudo apt-get purge $(cat /tmp/old_kernels)
df /boot/
For auto-installed kernels that are not kept back:
apt-get autoremove --purge
Django Migrations
Limit Memory (RAM) and CPU in Docker Compose