How To Clean Your Linux Boot Menu With Automated Bash FilesBy Shaon, Gaea News Network
Friday, December 10, 2010
The Ubintu/Linux boot menu after using the same installation for many times would look incredibly messy with entries of older Linux kernels remaining active. One way to get rid of them is by manually uninstalling the older kernels. Understandably that process can lead to huge complications and if any thing goes wrong? Well you will to the dreaded re-installation. By the end of this article you will find a way to clutter free your grub menu.
The useful bash script will be able to do the same thing for you and that too without any hassles whatsoever. The older kernels will make your boot menu a messy place and also eat up hard drive space. Instead of uninstalling one by one we recommend that you use this bash script to automate the process.
You will need to copy the code below and paste it in a text editor. Then you must save the file as cleanKernels.sh.
ls /boot/ | grep vmlinuz | sed ’[email protected]@[email protected]’ | grep -v `uname -r` > /tmp/kernelList
for I in `cat /tmp/kernelList`
aptitude remove $I
rm -f /tmp/kernelList
Whenever you will need to clean up the boot menu clutter you will have to open the terminal and run
sudo bash /path/to/cleanKernels.sh
path/to/cleanKernesl.sh being the location where the file is being saved.