Change default boot kernel in Linux Grub2

When you have to change the default boot kernel of Linux which uses Grub2, instead of going through the /etc/grub2.cfg  file, here is a quick and easy tip on how to identify the kernels and set the boot kernel.

This command lists all the kernel versions installed on your machine. Note that the position of a menu entry in the list is denoted by a number starting with zero.

Change the kernel version by issuing the grub2-set-default command. This sets default boot kernel in grub2.cfg as default run. Changing the kernel version requires a reboot.

The value number “2” passed as an argument to this command selects the kernel 2 listed above.