Linux Commands

How do I change the GRUB timeout in Linux?

This tutorial shows how to easily change the GRUB timeout in Linux. After reading this tutorial, you’ll know how to edit the Grub timeout in a few steps.

Before starting, if when you boot your computer, GRUB doesn’t show up, jump to the What to do if GRUB menu doesn’t show up section.

Changing GRUB timeout in Linux:

To begin, edit GRUB’s configuration file. You can use the command below to edit it using the nano text editor.

sudo nano /etc/default/grub

Find the line containing “GRUB TIMEOUT=5” shown in the following screenshot; in my case (Debian), it is the second uncommented line.

GRUB_TIMEOUT=5

This is the line you need to edit to change the GRUB timeout; just replace the default 5 with another value; for example, to change the timeout from 5 seconds to 10 seconds, edit the following line.

GRUB_TIMEOUT=5

And leave it as

GRUB_TIMEOUT=10

Once you edit the line, exit nano saving changes by pressing Ctrl+X and update-grub to apply changes, to update Grub, run the command below.

sudo update-grub

Now when you reboot your computer, you’ll see the new timeout.

What to do if the GRUB menu doesn’t show up:

If the GRUB menu doesn’t show up when you boot your computer, it may be hidden. If you are using Legacy BIOS, you can display it by pressing the Shift key several times when booting. If you use UEFI, then press Esc. This will show the GRUB menu one time.

In my Ubuntu device, when checking GRUB’s configuration file /etc/default/grub, an additional line hides the GRUB menu. To show GRUB’s menu permanently, the following line:

GRUB_TIMEOUT_STYLE=hidden

Must be changed as shown in the screenshot below to:

GRUB_TIMEOUT_STYLE=menu

Then, you can edit the previously mentioned line to change the timeout. For example, to change the timeout from 5 seconds to 10 seconds, edit the following line.

GRUB_TIMEOUT=5

And change it to:

GRUB_TIMEOUT=10

Then close nano saving changes (Ctrl+X).

Now you need GRUB to apply the changes you made. For this, you need to update GRUB. To update GRUB, run the following command.

sudo update-grub

When you reboot, the GRUB menu will stay for 10 seconds, or the number you defined in the line containing GRUB_TIMEOUT=.

As you can see, now GRUB gives 10 seconds to choose an option or boot automatically.

What is GRUB, and how it works:

GRUB (Grand Unified Bootloader) is a bootloader that allows the user to choose the kernel, OS, or boot mode. Since the BIOS does not recognize file systems, this task is passed to the bootloader, which loads the files into RAM.

Grub is the first program that runs when the user turns on his computer. The bootloader task is to boot the correct operating system or kernel previous to system initialization.

In this case, the bootloader, or GRUB, is located in the MBR (Master Boot Record). The MBR is a hard disk or partition sector containing information on file systems and partitions, as well as the bootloader. Grub is also compatible with BSD systems (FreeBSD, NetBSD, OpenBSD); other kernels are supported through chain loading.

You can get additional information on GRUB at https://www.gnu.org/software/grub/ or https://www.gnu.org/software/grub/manual/grub/grub.html.

Conclusion:

As you can see, any Linux user level can easily edit GRUB’s timeout. Managing GRUB is pretty easy, and the most common mistake is to forget to update it after changes. Other known bootloaders are BURG (Brand-new Universal Loader from GRUB), LILO (Linux Loader), and Syslinux.

I hope this article explaining how to change the GRUB timeout in Linux was useful. Keep following Linux Hint for additional Linux tips and tutorials.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.