I have both Windows 7 and Ubuntu installed on a shared machine. Because a lot of the non-developers use Windows, I'd like to change the boot order to make it easier for them.

Currently the boot order looks like the following:

  • Ubuntu 11.10 kernelgeneric *86
  • Ubuntu 11.10 kernelgeneric *86 (safe boot)
  • Memory test
  • Memory test
  • Windows 7 on /dev/sda6

How do I change the default order so that Windows 7 is at the top of the list?

  • Windows 7 on /dev/sda6
  • Ubuntu 11.10 kernelgeneric *86
  • Ubuntu 11.10 kernelgeneric *86 (safe boot)
  • Memory test
  • Memory test
  • 5
    Similar Q&A: askubuntu.com/questions/52963/…
    – fossfreedom
    Commented May 20, 2012 at 18:58
  • Did you do a 'sudo update-grub' after changing the grub file?
    – Tinellus
    Commented Jun 27, 2012 at 12:49
  • yes I think I may have forgotten to do that, thank you! I will try and update with the results. Commented Jun 27, 2012 at 12:51
  • kubuntu 14.04 sudo apt-get install kde-config-grub2 then in system config goto startup shutdown
    – n611x007
    Commented Oct 4, 2015 at 23:10

8 Answers 8


You can also change the grub default boot entry from the command line without having to install any additional tool. This won't change the order in the list but it will allow a different OS to boot by default, which sounds like what you may want anyway.

First, make a backup copy of /etc/default/grub. In case something goes wrong, you can easily revert to the known-good copy:

sudo cp /etc/default/grub /etc/default/grub.bak

Then edit the file using vim or the text editor of your choice:

sudo vim /etc/default/grub

Find the line that contains


and set it to


where x is the index of grub menu item to which you would like to boot to by default. Note that the menu items are zero-indexed. That means that the first item in the list is 0 and that the sixth item is actually 5. So to boot to the sixth item in the list, the line would read:


If you forgot the order of the items, take a look at /boot/grub/grub.cfg. Each menu entry is specified by a line of type:

menuentry 'Ubuntu' [options] {

You can also chose the default by the name instead of index, e.g.:


if there was a menuentry 'Ubuntu' line on /boot/grub/grub.cfg. This may be a better method, as it does not depend on the order of the entries, which could change.

To use a kernel in the "Previous Linux Versions" sub-menu use:

GRUB_DEFAULT="Advanced options for Ubuntu>x"

(make sure to include the quotations), where x is the index of the old kernel on the sub-menu, or the name of the kernel as it appears in /boot/grub/grub.cfg. For example,

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-45-generic"

Then build the updated grub menu:

sudo update-grub
  • 8
    Last I looked grub2 generates so many entries on the fly that it's really hard to figure out what number to use for an entry.
    – Joe
    Commented Jun 20, 2012 at 17:53
  • 76
    Using an index can be pretty messy - the list of OSes can change after an update. But you can have a look into /boot/grub/grub.cfg and search for the name of desired default OS. Then use the quoted name instead of an index. Example: GRUB_DEFAULT="Microsoft Windows XP Professional (on /dev/sda1)" instead of GRUB_DEFAULT=7
    – geekQ
    Commented Dec 9, 2012 at 11:57
  • 3
    This needs an update related to the dual levels of current grub menu.
    – Hannu
    Commented Aug 21, 2015 at 9:47
  • 10
    With the current version of Ubuntu 16.04, if you want to select a specific Kernel to boot to, you need to add to the Advanced options for Ubuntu sub menu, like this: GRUB_DEFAULT='Advanced options for Ubuntu>Ubuntu, with Linux 4.4.0-34-generic' Commented Sep 13, 2016 at 14:30
  • 4
    Run grep -e ^menuentry /boot/grub/grub.cfg to quickly see your grub menu items. This makes it easier to count (starting at 0) up to the menuentry you want to be the default.
    – MathKid
    Commented Jul 19, 2017 at 21:59

You can use an easy-to-use the GUI application called Grub Customizer to make your life a little bit easier. As the name suggests, you can do much more than just reordering GRUB menu entries with it. You can install it from a PPA in 18.04 and older releases, and from the official repositories in 20.04 and newer.

In 18.04 and older releases, add this PPA (you can skip this command on 20.04 and newer):

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

And then run:

sudo apt-get update
sudo apt-get install grub-customizer

(See also this Ask Ubuntu question)

There is an How-To Geek article about it, How to Configure the Linux GRUB 2 Boot Menu the Easy Way. Take a look at it if you're interested. Also, there is a solved thread on the Ubuntu Forums, Change boot order in GRUB 2 that mentions this tool.

Here are some screenshots:

GRUB Customizer

GRUB Customizer - Settings - General

GRUB Customizer - Settings - Advanced

Some troubleshooting:

The Grub Customizer settings may work only from within the latest Linux/Ubuntu installation, the one that installed the Grub.

For example, if somebody has two OS-es installed (Windows and Ubuntu), and then installs a third OS (Manjaro, etc) and then tries to follow the above answer, Grub Customizer changes will not work when made from the second OS (Ubuntu, in the example). The program has to be installed in the third OS, as it seems that Grub Customizer can only edit the Grub files created by the installation of the system on which itself is installed.

The files that determine the Grub boot menu come in most cases with the latest system installed on a machine, so Grub Customizer has to be installed and used from that Linux system.

  • 4
    Most welcome :) The screenshots come from the blogpost that's linked above :P Commented Jan 31, 2012 at 17:51
  • 3
    This doesn't work with the latest Ubuntu. Can we get an updated post here?
    – A T
    Commented Jul 30, 2012 at 21:34
  • 12
    I think your answer is good and helpful, so please don't get me wrong. While GUI tools are neat and easy, they hide the facts. Marve's answer below discusses files in use and how to update them manually, providing insight as to how Grub works. When the GUI Fails, and it will for some, at least take a peek at the underpinnings - they are not that difficult after all and manual manipulation will probably be easier in the long run. Commented Jan 26, 2014 at 5:14
  • 2
    Ubuntu 20.04 has the package: 'grub-customizer' in its repository, so no need to add a PPA!
    – koni_raid
    Commented Aug 26, 2021 at 10:38
  • 2
    DO NOT USE GRUB CUSTOMIZER. It is apparently riddled with bugs and issues, is impossible to uninstall and/or revert, and totally screwed my system up. Please DO NOT RECOMMEND GRUB CUSTOMIZER.
    – B T
    Commented Aug 11, 2022 at 17:11

From the tombuntu site (article by Tom):

GRUB can be configured using the /etc/default/grub file. Before you make any changes to it, it may be a good idea to back it up by creating a copy:

sudo cp /etc/default/grub /etc/default/grub.bak

You can restore the copying the backup over the original:

sudo cp /etc/default/grub.bak /etc/default/grub

Open the file using the text editor with root privileges:

gksu gedit /etc/default/grub

The line GRUB_DEFAULT=0 means that GRUB will select the first menu item to boot. Change this to GRUB_DEFAULT=saved. This change will make it easier to change the default item later.

Save and close the file. Run this command to apply your changes to GRUB’s configuration:

sudo update-grub

The configuration change we made allows the grub-set-default and grub-reboot commands to be used at any time. These allow you to change the default boot item permanently or only for the next boot, respectively.

Run grub-set-default or grub-reboot (with sudo) with the number of the menu item to boot (the first item is 0). This command will change the default to the second item:

sudo grub-set-default 1
  • 18
    This answer is taken almost verbatim from tombuntu.com/index.php/2011/09/25/…. Please give credit where credit is due. Commented Nov 6, 2012 at 23:00
  • 1
    This answer doesn't seem to change the order of the boot items.
    – Sparhawk
    Commented May 26, 2014 at 3:44
  • I am using Linux Mint Debian Edition. I didn't have a /etc/default/grub , but found the GRUB_DEFAULT value to modify was instead in /etc/grub.d/00_header . After modifying GRUB_DEFAULT in 00_header with my desired boot entry name, I simply ran "sudo update-grub" and voila, success. Commented Dec 14, 2014 at 3:11
  • I saw these same commands in tipsonubuntu.com/2016/07/20/grub2-boot-order-ubuntu-16-04 I realized that these commands will only work if they were issued from the system in boot order 0 first.
    – Sun Bear
    Commented Jan 2, 2018 at 1:35

I know this is a very old question and I don't have enough reputation to comment this, so for anyone still looking to do it without Grub-Customizer because of it's infamy:

This method assumes you have a dual-boot with one Linux and a Windows installation. Since the order in /etc/grub.d specifies the order in which they are called, you could simply call os-prober first and then add the remaining entries.

cd /etc/grub.d
mv 30_os-prober 05_os-prober
sudo update-grub

This works great and puts Windows on top of the list.

I can't find the source, but will provide it if I come across it again.

  • This is by far the simplest solution and works as long as you only have one OS that is found by os-prober. In fact, on Ubuntu 20.04, the README inside /etc/grub.d effectively tells you to do exactly that.
    – R Schultz
    Commented Jan 23, 2022 at 17:24


Please note that this will make a large mess of all of your GRUB files. Please be aware of that annoying issue! That is all you need to know prior to starting.

On startup, enter Ubuntu. When Ubuntu starts up, enter either the terminal. Enter the following commands:

gksudo gedit /etc/default/grub

When that command opens, chnage GRUB_DEFAULT=0 to GRUB_DEFAULT=saved and then enter. Update GRUB with the command

sudo update-grub

Finally, set default OS with sudo grub-set-default NUMBER. NUMBER is the number of the OS that you want to set to default.


Install GRUB-customizer with the following commands:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

sudo apt-get update

sudo apt-get install grub-customizer

Cited from: https://tipsonubuntu.com/2016/07/20/grub2-boot-order-ubuntu-16-04/

This may provide more detailed information on what you are looking for. I hope this helps.

  • 1
    This should really accompany a warning that this will make a mess of your grub files and make it difficult to manage without the tool (I'm speaking from experience, as this is my current situation)
    – Jared
    Commented Feb 22, 2021 at 23:57
  • 1
    Good point. Sorry about that!
    – Logan
    Commented Feb 23, 2021 at 18:28


sudo add-apt-repository ppa:danielrichter2007/grub-customizer


sudo apt-get update


sudo apt-get install grub-customizer

Open Grub Customizer And you can edit your grub You can even change your grub wallpaper it's a great tool

Risk Involved whether you use the tool or edit the grub.cfg file


I tried the following and got good results.

Open up a terminal window (Ctrl+Alt+T),

Type sudo gksu nautilus and press Enter. Type in your user password.

Navigate to the file /boot/grub/grub.cfg. Copy and Paste the file into same directory, should create copy of the grub.cfg file for backup purposes. Then double-click grub.cfg to open the file in a text editor.

In the file you will find the line (set default="0"). Edit the 0 to the line number in Grub that you want to load. Mine was the sixth line, so I used 5, as the first line is considered 0. Save the file. Reboot the pc and if you chose the correct line it will be the highlighted one when Grub loads.

Good luck

  • 12
    as you can see in the beginning of the file, it says that you should not do this. instead edit /etc/default/grub and then run update-grub.
    – sazary
    Commented Oct 23, 2012 at 11:32
  • 9
    and I wouldn't recommend to gksu nautilus either. Too easy to drop a bomb in your system from there.
    – sylvainulg
    Commented Mar 28, 2013 at 9:20
  • check this post: psychocats.net/ubuntu/bootmenu
    – tqjustc
    Commented Jan 28, 2015 at 22:07
  • 1
    For some reason this answer is shown as "automatic answer" in google when searching for: "grub change boot order".
    – lepe
    Commented Sep 11, 2015 at 0:55
  • @lepe, don't worry, for me default is linuxandubuntu.com/home/…
    – vladkras
    Commented May 15, 2016 at 7:24

Open up a terminal window (Ctrl+Alt+T), or press Alt+F2.

Type gksu nautilus and press Enter.

That will open up the file browser Nautilus with permission to change files owned by root.

Navigate to the file /boot/grub/grub.cfg and double-click to open the file in a text editor.

Cut, move and paste the sections in that file that belongs to different operating systems. You must be very careful when doing this, as if you do it wrong then you won't be able to boot anymore. Windows boot can always be repaired with the tools from a windows installation disc (FIXMBR), that overwrites GRUB-MBR with a typical Windows-MBR.

I have tested it from Ubuntu 9.04 to 12.04 and it has worked fine every time.

But I have only tried to move the Windows boot section to the top of the list to make it become the default.

If my memory is correct, each boot menu section in the file starts with a begin ... and ends with an ...end. And spans multiple text rows.

The text in that file has become a bit more complicated and it doesn't look the same in the last Ubuntu version as in previous versions. So use your brain to save you from doing a mistake.

  • 4
    Don't you have to run sudo update-grub at some point? Commented Jul 6, 2012 at 12:01
  • 5
    /boot/grub/grub.cfg is being overwritten at every package installed/updated triggering an update of Grub, effectively invoking update-grub. And that generates a new grub.cfg. Therefore, configuring Grub is done in files in the /etc directory as explained by the other answers, to make sure it's persistent.
    – gertvdijk
    Commented Sep 19, 2012 at 20:16
  • What I don't understand is what does Nautilus even do for this? How does it have anything to do with boot order changes?
    – Logan
    Commented Mar 10, 2020 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .