Sometime's you'll notice multiple old kernels taking up disk space on the server, more specifically when you've a seperate /boot partition which is standard practise.
You can remove old kernels using the following commands from the bash shell.
Debian / Ubuntu
# sudo apt-get autoremove
This command will automatically remove any packages, installed by other packages, that are no longer required, this includes kernel modules.
Firstly, you can check your running kernel by using the following:
# sudo uname -r
3.16.0-4-amd64 You can also manually remove old kernels, first, you can list the installed kernels with the following: # sudo dpkg --list | grep linux-image
ii linux-image-3.16.0-4-amd64 3.16.7-ckt20-1+deb8u3 amd64 Linux 3.16 for 64-bit PCs
ii linux-image-amd64 3.16+63 amd64 Linux for 64-bit PCs (meta-package)
Before using apt-get to remove any unrequired kernels on the system.
# sudo apt-get --remove linux-image-3.16.0-4-amd64
CentOS / RedHat / Fedora
Firstly, you can check your running kernel by using the following:
# sudo uname -r
2.6.18-406.el5
You will need to remove each kernel invidivually using "yum".
The installed kernels can be listed using the following:
# sudo rpm -qa kernel
kernel-2.6.18-404.el5
kernel-2.6.18-407.el5
kernel-2.6.18-402.el5
kernel-2.6.18-408.el5
kernel-2.6.18-406.el5
Yum can then be used to remove any old kernels.
# sudo yum remove kernel-2.6.18-404.el5