How to Change Default OS in Dual Boot: Linux or Windows

In a dual-boot setup, you typically install Windows first and then the Linux OS second. When you do this, the boot menu is managed by GRUB, the bootloader installed by the Linux OS.

Grub dual boot menu
This is what the GRUB dual-boot menu looks like (yours could be different).

By default, Linux will be the default OS. If you want to change the default OS, first you need to boot into the Linux OS (it doesn't matter if you have installed Ubuntu, Linux Mint, or any other Linux distribution; the procedure is the same). Then, edit the /etc/default/grub file.

But before that, take note of the menu order on your computer. Each entry has an index starting from 0 (yours may be different from mine).

Dual-boot priority order
The index starts at zero.

So, in this example, the first entry, Ubuntu, has an index of 0, while the index number for Windows is 4.

To change the default boot entry, follow these steps (with root privileges)

  1. Boot into your Linux OS.
  2. Edit the GRUB configuration - Open the /etc/default/grub with a text editor. You can use a command line editor line vim or nano.
  3. Change the default - Locate the GRUB_DEFAULT directive and update its value to match the entry you want to set as the default.
    GRUB_DEFAULT=4
  4. Save and update GRUB - Save the changes to the /etc/default/grub file and then update GRUB with the following command.
    sudo update-grub

And that’s it! The next time you boot your computer, the new default boot option should take effect.