Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Remove Old Kernel Lines

If you upgraded your Ubuntu 16.04 machine to the 4.13 kernel, it can be annoying to keep getting updates for the 4.4 and 4.8 kernels if you don't want them anymore. To remove the existing kernels and prevent getting future 4.4 and 4.8 kernels, run the following: Make sure you are running in a 4.15 kernel before performing the steps below. Check this by running uname -a.

# Remove 4.4 kernels
sudo apt-get remove linux-headers-4.4.* -y && \
sudo apt-get remove linux-image-4.4.* -y && \
sudo apt-get autoremove -y && \
sudo update-grub

# Remove 4.8 kernels
sudo apt-get remove linux-headers-4.8.* -y && \
sudo apt-get remove linux-image-4.8.* -y && \
sudo apt-get autoremove -y && \
sudo update-grub

# Remove 4.10 kernels
sudo apt-get remove linux-headers-4.10.* -y && \
sudo apt-get remove linux-image-4.10.* -y && \
sudo apt-get autoremove -y && \
sudo update-grub

# Remove 4.13 kernels
sudo apt-get remove linux-headers-4.13.* -y && \
sudo apt-get remove linux-image-4.13.* -y && \
sudo apt-get autoremove -y && \
sudo update-grub

References

Last updated: 4th January 2023
First published: 16th August 2018