Debian / Ubuntu Linux Delete Old Kernel Images Command

In Debian and Ubuntu Linux, old kernel images can be deleted using the dpkg command. To delete old kernel images, follow these steps:

  1. Run the following command to list all installed kernel packages:
dpkg -l | grep linux-image
  1. Look for the older kernel images that you want to delete and make a note of the package names.
  2. Run the following command as root to remove the older kernel images:
apt-get remove linux-image-<version>

Replace <version> with the actual version number of the kernel image you want to remove.

  1. After removing the kernel images, you should also clean up any remaining packages and dependencies using the following command:
apt-get autoremove
  1. Finally, run the following command to update the boot loader and remove any old entries:
update-grub

It’s recommended to keep at least one older kernel image in case the current kernel has any issues and you need to fall back to an older version. However, if you have multiple older kernel images, you can safely remove all but the most recent one.

Leave a Comment