How to remove old kernels in Grub2, including files.
Using the Disk Usage Analyzer, I found that the Linux kernels are located in 4 areas of the root directory: /boot /lib/firmware /lib/modules /usr/src
All we have to do is, go to each directory and remove the files or directories that are not needed.
Use the command [rm] for files and [rm -r] for directories. You have to use [sudo su] to have administrative account, or use [sudo (command)] to invoke administrative command.
For our example, we will use the linux kernel version 4.4.0-112 You can choose which version you will remove.
at /boot = kernels are all files : abi-4.4.0-112-generic config-4.4.0-112-generic initrd.img-4.4.0-112-generic retpoline-4.4.0-112-generic System.map-4.4.0-112-generic vmliniz-4.4.0-112-generic
(note: not all kernel versions have these files included above)
at /lib/firmware = kernels are in subdirectories : 4.4.0-112-generic
at /lib/modules = kernels are in subdirectories : 4.4.0-112-generic
at /usr/src = kernels are in subdirectories : linux-headers-4.4.0-112 linux-headers-4.4.0-112-generic
Now all we need to do is use the command [update-grub]
This will free your hard disk around 300MB worth of disk space for every kernel that you will remove.
Please note that I am using Ubuntu 16.04 Xenial.
And if anybody knows how to delete files in GUI, please let me know, it would be alot easier.
sudo rm
for ANY files in /boot unless you know exactly what you are doing. Most of those files are created and removed by apt (and apt hooks). If you muck with them, the resulting apt errors will block most apt installs, removals, and upgrades. They can be quite tedious to repair, and you have better things to do with your time. – user535733 Jun 25 '18 at 17:24