Debian / Ubuntu Linux Delete Old Kernel Images Command

Debian / Ubuntu Linux Delete Old Kernel Images Command

To delete old kernel images on a Debian or Ubuntu system, you can use the apt-get command with the purge option. This will remove the kernel images and their associated packages from your system, freeing up disk space.

  1. First, check which kernel images are installed on your system using the dpkg command:
refe‮tual:ot r‬turi.com
dpkg --list | grep linux-image

This will list the installed kernel images, along with their version numbers.

  1. Determine which kernel images you want to delete. It is generally recommended to keep the latest two or three kernel images in case you need to boot into a different kernel for any reason. You can delete the older kernel images.

  2. Uninstall the kernel images you want to delete using the apt-get command with the purge option. For example, to delete the linux-image-4.19.0-8-amd64 kernel image, you can run the following command:

sudo apt-get purge linux-image-4.19.0-8-amd64

This will remove the kernel image and its associated packages from your system.

  1. Repeat step 3 for each kernel image you want to delete.

  2. After deleting the old kernel images, you can use the update-grub command to update the boot menu and remove the entries for the deleted kernel images:

sudo update-grub

This will update the boot menu and remove the entries for the deleted kernel images.

Note: It is generally recommended to keep at least one kernel image on your system in case you need to boot into a different kernel for any reason. Be careful when deleting kernel images, as it can cause problems if you delete the kernel image that your system is currently using.

Created Time:2017-10-28 14:02:25  Author:lautturi