GRUB is the default boot loader for all Enterprise Linux. It load all the Linux Distro as well as other operating system with ease. It provides a menu which shows all the the operating system in one place. The GRUB has advanced feature as well as some basic features that makes it effective on all enterprise grade Linux. This guide provides to change the default GRUB Entries as well as to change the timeout according to the user requirements on respective Enterprise Linux that supports the GRUB.

Step-1 (Login to the root user)
$ su -
Password:
Step-2 (List all the GRUB2 boot entries)
# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2

Sample Output

CentOS Linux 8 (Core), with Linux 3.10.0-229.el7.x86_64
CentOS Linux 8 (Core), with Linux 0-rescue-7e890c03ebb940a9a67163adaef14894
Windows 10 (loader) (on /dev/sda1)
menuentry "Windows 10 (loader) (on /dev/sda1)"
Step-3 (Change the default boot entry)

These command is use to set the entry as a default.

# grub2-set-default 3

Note you can change the 3 according to your choice of entries this is the default entries to boot.

Step-4 (Check whether it is added to the default entry)

This command shows the list of GRUB entries.

# grub2-editenv list

Sample Output

saved_entry=3
Step-5 (Save all the changes in GRUB2)
# grub2-mkconfig -o /boot/grub2/grub.cfg

Sample output

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7e890c03ebb940a9a67163adaef14894
Found initrd image: /boot/initramfs-0-rescue-7e890c03ebb940a9a67163adaef14894.img
Found Windows 10 (loader) on /dev/sda1
done

Login to the root user

$ su -
Password:
Step-6 (Change GRUB menu time out)
# vi /etc/default/grub

Sample Output

GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Note: You can make change “GRUB_TIMEOUT=ANY-POSITIVE-NUMBER” to it for making change the timeout period according to your choice.

Step-7 (Save all the changes in GRUB)

This command loads all the entries during boot time and apply those changes.

# grub2-mkconfig -o /boot/grub2/grub.cfg

Congratulations now you have change the GRUB entries and time on CentOS and RHEL.

Also Read  RPM and YUM Commands Cheat Sheet for CentOS 7 / RHEL 8