grub-mkconfig
Grub-mkconfig is a command line tool used in Linux systems to generate the configuration file for the GRUB bootloader. GRUB (GRand Unified Bootloader) is a popular bootloader used to load the operating system during boot.
The grub-mkconfig command is used to automatically detect installed operating systems and generate a GRUB configuration file (/boot/grub/grub.cfg) based on that information. This configuration file contains entries for each detected operating system and various boot options.
By running grub-mkconfig, the user does not have to manually edit the GRUB configuration file, which can be a complex task. Instead, the tool automatically scans the system for installed operating systems and creates the necessary entries.
The command supports various options and arguments, allowing users to customize the generated configuration file. For example, you can specify the output file path, customize the appearance of the GRUB menu, include custom kernel parameters, and more.
Grub-mkconfig reads system-specific scripts in the /etc/grub.d/ directory and uses them to determine the list of operating systems and generate their respective entries in the configuration file. Users can modify or add their own scripts in this directory to customize the boot menu behavior.
The tool also takes the /etc/default/grub file into account, which contains various default settings for GRUB such as timeouts, default boot entries, and more.
Grub-mkconfig generates the GRUB configuration file based on the information it gathers at the time of execution. It is recommended to run the command whenever changes are made to the system, such as installing or removing operating systems, changing kernel parameters, or modifying GRUB settings.
Once the configuration file is generated using grub-mkconfig, it is automatically read by GRUB during boot, allowing users to select the desired operating system and boot options from the GRUB menu.
Grub-mkconfig is a powerful tool that simplifies the management of GRUB bootloader configuration, making it easier for users to select and boot their preferred operating systems on a Linux system.
List of commands for grub-mkconfig:
-
grub-mkconfig:tldr:1687d grub-mkconfig: Generate the configuration file.$ sudo grub-mkconfig --output=${-boot-grub-grub-cfg}try on your machineexplain this command
-
grub-mkconfig:tldr:af06f grub-mkconfig: Print the help page.$ grub-mkconfig --helptry on your machineexplain this command
-
grub-mkconfig:tldr:b71d4 grub-mkconfig: Do a dry run and print the configuration to `stdout`.$ sudo grub-mkconfigtry on your machineexplain this command