Ubuntu clean old useless Linux kernel files tutorial

Source: Internet
Author: User
Tags versions

In the Ubuntu environment, we have a number of ways to upgrade the kernel. The Ubuntu desktop version upgrades the kernel as it updates every day, and Ubuntu Server can upgrade the kernel using Unattended-upgrade Automatic Updates, as well as using apt-get or aptitude to simultaneously accommodate the Ubuntu desktop or service Service version.

With the passage of time, the replacement of the old version of the kernel will occupy a certain amount of disk space and cause waste. Each kernel image file and associated module file/header (header file) consumes approximately 200–400 M of disk space, and if the kernel version is upgraded frequently, the waste of the old kernel files on the space will increase rapidly.

You can view all bootable versions of the kernel files using the following command:

ll/boot/

Clean up Ubuntu old Linux kernel files

Before we start cleaning up, please be sure to keep at least two recent kernel versions to ensure that there is one more retreat after the problem.

The kernel image files for Ubuntu mainly include the following types of packages:

linux-image-< version number >: Kernel image files

linux-image-extra-< version number >: Extended kernel Module

linux-headers-< version number >: Kernel header file

1. First look at what version of the kernel the current system has installed:

Dpkg--list | grep linux-imagedpkg--list | grep linux-headers

2. After determining the version to be deleted, we can use the following command to delete:

sudo apt-get purge linux-image-3.19.0-23sudo apt-get purge linux-headers-3.19.0-23

The appeal command deletes the kernel image file and its associated kernel module and header file.

Note: If you have not upgraded to the latest kernel version of the Ubuntu update when removing the old kernel, the system will automatically trigger the upgrade to the latest kernel. Also, after removing the old kernel, the grub configuration is automatically updated and the dependencies are removed from the Grub menu.

3. If the GRUB configuration does not automatically refresh after removing the old kernel, you can manually refresh using the following command:

sudo update-grub2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.