How To Change Boot Order in Ubuntu/Grub

If you are running Ubuntu (or any other Linux distro) and Windows in one computer most probably you are using Grub to support dual booting. Or may be two or more different Linux as I am running Debian and Ubuntu. During installation process most Linux distor install Grub which is short for GNU GRand Unified Bootloader and provides a user with choice to boot one of multiple operating systems installed on a computer or select a specific Linux kernel configuration available on a particular operating system.

So if you are dual booting most probably you are familiar with this screen and most probably you are wondering how to change boot order.
Ubuntu Change Boot Order Grub

First open and edit file /etc/default/grub by executing the following command.

howopensource@ubuntu:~$ sudo gedit /etc/default/grub

Find the line GRUB_DEFAULT=0 and change to GRUB_DEFAULT=saved. For more info look into the screenshot.
Grub Config File Ubuntu

Then execute command to update Grub configuration. Command update-grub reads file /etc/default/grub and generates proper Grub configuration file.

howopensource@ubuntu:~$ sudo update-grub

To change boot order just execute the next command.

howopensource@ubuntu:~$ sudo grub-set-default 4

Pay attention that boot items are count from 0, not from 1. Also next time when you want to change boot order you just need to execute the last command – grub-set-default.

Ubuntu Grub Update Boot Order

Hope this helps you to understand how Grub works. if you have problem with Grub you can read another article how to repair Grub from Ubuntu live CD.