Generate a GRUB configuration file

It is sometimes needed to create a new, modify og recreate the grub configuration file.
One easy tool to regenerate the config file is the command grub2-mkconfig.
This command has helped me add a grub Windows startup option after installing CentOS 7.

Write the output of the command to console

# grub2-mkconfig

Write a new grub config file, overwriting the existing file

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

This has been tested on CentOS 7 / RHEL 7.