How To Clean Your Linux Boot Menu With Automated Bash Files

By 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.

#/bin/bash
ls /boot/ | grep vmlinuz | sed ’[email protected]@[email protected]’ | grep -v `uname -r` > /tmp/kernelList
for I in `cat /tmp/kernelList`
do
aptitude remove $I
done
rm -f /tmp/kernelList
update-grub

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.

via

Filed under: Featured Article, How To

Tags: ,
Discussion

sibel kekilli
December 24, 2010: 9:39 am

Very useful plagin, imho. thanks for it.

December 13, 2010: 8:27 am

Thanks for sharing the details. It was very helpful indeed.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :