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
Last updated: 12th May 2020
First published: 16th August 2018

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch