Programster's Blog

Tutorials focusing on Linux, programming, and open source

Update Grub Timeout

After a fresh install of your OS, you may wish to speed up the boot time by reducing the timeout period of your grub menu to 1 so that you always just boot straight to the latest kernel. Likewise, if you are in the process of compiling your own kernel, you may wish to increase it so that its easier to get to the menu and select a different kernel if it didn't work out for you. The script below shows you how to easily do this, just make sure to update the TIMEOUT variable:

TIMEOUT="1"

SEARCH="set timeout=.*"
REPLACE="set timeout=$TIMEOUT"
FILEPATH="/boot/grub/grub.cfg"
sudo sed -i "s;$SEARCH;$REPLACE;g" $FILEPATH

If you want a quick and easy way to just set it to 1 second, then you can just use a one line command with prog-exec.

curl -s https://scripts.programster.org/scripts/8?output=raw | bash