Forrest logo
back to the grub-reboot tool


grub-reboot: Set the default boot entry to an entry number, name or identifier for an alternative boot directory for the next boot.
$ sudo grub-reboot --boot-directory ${-path-to-boot_directory} ${entry_number}
try on your machine

The sudo grub-reboot command is used to set the default boot option for the next system startup. It allows you to choose a different operating system or kernel version to boot into, rather than the default option set in the GRUB bootloader menu.

Here is a breakdown of the command syntax:

  • sudo: This is a command used in Unix-like operating systems to execute a command with superuser (root) privileges. It allows you to run the following command as an administrator.

  • grub-reboot: This is the command that specifies you want to set the default boot option for the next system startup. It's a part of the GRUB bootloader utility.

  • --boot-directory ${-path-to-boot_directory}: This option specifies the path to the directory where the GRUB bootloader files are stored on your system. You need to replace ${-path-to-boot_directory} with the actual path to your boot directory. For example, it could be /boot/ or /boot/grub/.

  • ${entry_number}: This is the parameter that specifies the entry number of the boot option you want to set as the default. The number is typically based on the order of the boot options listed in the GRUB menu, starting from 0 for the first option.

By combining these elements, the command allows you to change the default boot option for your system without manually selecting it from the GRUB menu when your system starts up.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the grub-reboot tool