So, here's my situation:

- Using different versions of Ubuntu / CentOS
- Automatic updates were on -> Linux downloaded many new kernel versions
- Now I want to delete all other kernel versions, except the one I'm currently using

Code:
#find out current kernel version:
uname -r

#check which versions are downloaded to computer
dpkg --get-selections | grep linux-image

#delete desired kernel
sudo apt-get purge [KERNEL]

#autoremove
sudo apt-get autoremove

There can be easily more than 15 kernels in one linux, and I have more than 50 linuxes which I have to go through.


**So my question is, how can I automatically delete all other kernels which I'm not using?**