How to Remove Extra Kernels in Debian

  1. Run the following command to check the current installed kernel version:
dpkg -l | grep linux-image
  1. Execute the following command to check the current kernel version being used:
uname -r
  1. After confirming the excess kernel versions to be deleted, execute the following command to remove them:
sudo apt-get purge linux-image-x.x.x-x-generic
sudo apt-get purge linux-headers-x.x.x-x-generic

Please replace “x.x.x-x” in the command with the kernel version number that you want to delete. Remember to be careful when removing kernel versions to avoid deleting the one currently in use, which could prevent the system from starting up.

bannerAds