How to Change Default OS in Linux Grub Boot Menu [GUI & Command Line]

Dual-boot or multi-boot Linux with other systems on your computer? Well, you may want to set or change the Default system to boot on startup.

It’s easy to do the job either via graphical tool Grub-customizer, or by editing the configuration file in command line.

Method 1: Set Default OS via Grub Customizer

Grub-customizer offers a graphical interface to configure Grub / BURG settings and menu entries. The software features:

  • move, remove, rename menu entries.
  • edit the contents of menu entries or create new ones
  • reinstall the boot-loader to MBR
  • settings like default OS, kernel parameters, font, background, themes.

The software is available in the main repositories of most Linux systems. You can install it either via system package manager (e.g., synaptic) or by running command:

  • For Debian, Ubuntu based systems, run command:
    sudo apt install grub-customizer
  • For Fedora based systems:
    sudo dnf install grub-customizer

Once installed, launch Grub Customizer, navigate to General settings, and set the default OS entry. And of course click “Save” button to apply changes.

Method 2: Change Grub Menu Default OS in command line:

Working on Linux Server without desktop environment, or even if you don’t have internet connection? You can do the job simply by editing the configuration file.

1. Run command to list the Grub boot menu entries

In command console you may first run command to tell current startup menu entries (paste via Ctrl+Shift+V):
Then copy the line you want to set as default entry, which will be used in next step.

awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg

2. Edit /etc/default/grub file

Then run command to edit the grub configuration file:

sudo nano /etc/default/grub

When the file opens, change the value of GRUB_DEFAULT to the menu entry (the menu entry you get in step 1) with double quotation marks.
[epcl_box type=”error”]NOTE you have to use FULL TITLE of a selected menu entry as value of GRUB_DEFAULT. In the picture, I set Windows as default OS. As alternative, I can also set the value to: Ubuntu 18.04.5 LTS (18.04) (on /dev/sda5) or Ubuntu (on /dev/sda5)

For entries with Kernel name (e.g., Ubuntu, with Linux 5.4.0-40-generic) are sub-menus under “Advanced Options”. It’s not recommended to use sub-menus as default OS because the value is a little different. If you intend to use a sub-menu entry, see “Warning” when your run sudo udpate-grub command.[/epcl_box]

Press Ctrl+X, type Y, and finally hit Enter to save changes in nano text editor.

3. Update Grub to apply changes

Finally you have to run command to apply changes:

sudo update-grub

Conclusion:

It’s easy to change default OS via a graphical tool called Grub-Customizer. For Linux server without desktop UI or even no internet connection, you may edit /etc/default/grub and set the value of GRUB_DEFAULT. Note the value must be full title of an entry in current startup menu.

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.