• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

grub-mkconfig Command Examples in Linux

by Deepika

grub-mkconfig is a command-line utility that is used to generate a configuration file for the GRUB (GRand Unified Bootloader) bootloader. GRUB is a bootloader that is commonly used in Linux and Unix-like systems to load the operating system.

The grub-mkconfig command generates a new configuration file for GRUB based on the current system setup. The configuration file, typically called “grub.cfg”, contains information about the available operating systems and boot options, as well as other settings such as the default boot option and the timeout before the default option is automatically selected.

For example, to generate a new grub.cfg file for your system, you would use the following command:

# grub-mkconfig -o /path/to/grub.cfg

The -o option is used to specify the output file, by default it is /boot/grub/grub.cfg

grub-mkconfig looks for the configuration files in the /etc/grub.d/ directory, and those files have a number prefix that determines the order they are processed. It also looks for any other files with a .cfg extension in the /etc/grub.d/ directory and include them in the generated file.

It’s important to note that after any changes or updates to the system, for example, adding a new OS, adding a new kernel, etc. you should re-run the grub-mkconfig command to update the grub.cfg file and make sure that the changes are reflected in the boot menu. Also, if you run the command with the -o option, you should make sure that the output file is in the correct location and that it’s readable by the bootloader.

grub-mkconfig Command Examples

1. Do a dry run and print the configuration to stdout:

# sudo grub-mkconfig

2. Generate the configuration file:

# sudo grub-mkconfig --output=/boot/grub/grub.cfg

3. Print the help page:

# grub-mkconfig --help

Filed Under: Linux

Some more articles you might also be interested in …

  1. Understanding multipath Utility to Configure DM-Multipath
  2. pkgmk Command Examples in Linux
  3. Getting info with the vsish command (esxi only)
  4. protonvpn-cli connect Command Examples
  5. CentOS / RHEL : How to Recover from deleted /etc/passwd file
  6. What is the purpose of “mysql.sys@localhost” user
  7. Volume “test_vg/lvol0” is not active locally – Error while running lvcreate
  8. cal: command not found
  9. How to Enable IPv6 in CentOS/RHEL 8
  10. Linux OS Service ‘hplip’

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright