I have been going through various questions about how to clean up old Linux kernels. They all seem to have different answers and they are old, so someone is bound to say the question is too old and start a new post, so here it is:

**I want to do all the following:**

1. Remove old Linux kernels manually in terminal.
2. Remove all configuration files
3. Remove all header files
4. Remove unnecessary inodes?
5. Explain why dpkg -l | grep linux-image does not return the same results as what I see in my grub2 listing during boot
6. Explain rc vs ii in the dpkg -l | grep linux-image listing
7. Explain the discrepancy between entries in /usr/src directory (or wherever these files are found in other Ubuntu versions) and the above two methods of determining excess kernel versions.
8. What are the ramifications of a complete cleanup of older kernels. Do I need to worry about dependencies? How do I know if any apps on my computer are dependent on the configurations files of older kernels.

**What I don't want:**

* Links to other answers that you have not personally tested or do not address ALL the issues involved in a complete cleanup.
* Any answer you have not personally tested.
* Scripts that attempt to automatically clean everything at once. I just want to do this manually until I fully understand everything that is going on.

Let's please get a comprehensive solution to the kernel buildup problem. I am currently playing with an older version of Ubuntu (10.04) before I upgrade, but I have had the same problem with Ubuntu 12.04. If the solution is different for different versions, please state the version you used to test your solution.

What works:

```
uname -r

```

This correctly returns the kernel version I am currently using.

**Things that don't work:**

```
sudo apt-get autoremove
sudo apt-get clean
sudo apt-get autoremove linux-image-x.x.xx-xx-generic

```

What I thought should work, but did not:

```
sudo apt-get purge linux-image-x.x.xx-xx-generic

```

This worked to diminish the list generated by `dpkg -l | grep linux-image`:

```
sudo dpkg --purge linux-image-x.x.xx-xx-generic

```

Also here is a head start on the `rc/ii` issue:

`ii` means 'It should be installed and it is installed' whereas
`rc` means 'It's removed/uninstalled but it's configuration files are still there'.

I think this addresses the issue between the discrepancy between the terminal listing and the grub2 menu at bootup. As I recall, the `ii` listings match the grub2 listing. The question here is how did the `ii` entries get there in the first place?