• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How to Delete Old Kernels in Ubuntu

How to Delete Old Kernels in Ubuntu

By Sourabh / November 4, 2019 Category: How To, Ubuntu

How to delete old Kernels in Ubuntu; Remove old Kernels in Ubuntu Linux. On Ubuntu, first list the installed Kernels and then remove old Kernels via CLI/Terminal.

Remove Leftover Temp Files

Run the following command to delete leftover temporary files.

sudo rm -rv ${TMPDIR:-/var/tmp}/mkinitramfs-*

Step 1

Find out the current version of Linux kernel being used on the system and then list all installed kernels on the said system. To do so, run the following set of commands:

$ uname -sr
$ dpkg -l | grep linux-image | awk '{print$2}'

Step 2

Run the following command to list all the kernels excluding the booted kernel in the package database, and their status.

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

Remove Old Kernels

Once the Kernel to be removed is identified, run the following commands. For the example, we will remove Linux Kernel 4.2.0-15:


sudo update-initramfs -d -k 4.2.0-15-generic
sudo dpkg --purge linux-image-4.2.0-15-generic linux-image-extra-4.2.0-15-generic
sudo dpkg --purge linux-headers-4.2.0-15-generic
sudo dpkg --purge linux-headers-4.2.0-15
sudo apt-get -f install
$ sudo update-grub2
$ sudo reboot

Tags: Delete Old Kernels in Debian, Delete Old Kernels in Ubuntu, Delete Unused Kernels in Debian, Delete Unused Kernels in Ubuntu, How to Delete Old Kernels in Debian, How to Delete Old Kernels in Ubuntu, How to Delete Unused Kernels in Debian, How to Delete Unused Kernels in Ubuntu, How to Remove Old Kernels in Debian, How to Remove Old Kernels in Ubuntu, How to Remove Unused Kernels in Debian, How to Remove Unused Kernels in Ubuntu, Linux Mint Remove Old Kernels, Remove Old Kernels Centos, Remove Old Kernels in Debian, Remove Old Kernels in Ubuntu, Remove Unused Kernels in Debian, Remove Unused Kernels in Ubuntu, Ubuntu 14.04 Remove Old Kernels, Ubuntu 16.04 Remove Old Kernels, Ubuntu Autoremove Old Kernels, Ubuntu Boot Full Remove Old Kernels, Ubuntu List Installed Kernels, Ubuntu Remove Old Kernels Cli, Ubuntu Remove Old Kernels One Liner, Ubuntu Remove Old Kernels Terminal

Primary Sidebar

Latest Posts

Delete Directory And Contents Recursively Without Prompt On Linux

Check User Login History In Ubuntu Linux Command Line

Use Locate Command To Find File In Linux Terminal By Name

How To Change Terminal Color In Ubuntu Command Line

How To Run Fsck Manually In Linux To Fix Unexpected Inconsistency

How To Fix Broken Packages On Ubuntu From Terminal

Re Execute The Previous Command In Linux Ubuntu Command Line

How Much RAM Is Needed For Ubuntu PC

How To Find Large Files And Directories In Linux Command Line

How To Use Clear Command History In Linux Terminal

© 2026 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap