I have a dual boot system with Ubuntu 11.04 and Windows 7.

My GRUB bootloader defaults to Ubuntu. I mainly use Ubuntu, but I occasionally need to bootup Windows to do a few things.

If I need to do something in Windows I can "shutdown" Ubuntu and select Windows 7 in the bootloader. However, it would be more efficient if I could do this in one click from Ubuntu.

  • Is it possible to press a key in Ubuntu which means "Shut down, and then boot into Windows"? (or for that matter Shut down and boot into any non-default bootup)

In case you know the entry number for your Windows installation (start counting with 0 for first position) in the grub menu you can reboot into Windows (assuming to be 3rd on the list) by this command:

grub-reboot 2

Alternatively you can also use the textual entry used:

grub-reboot '<type entry here>'

This command can also be put in a launcher for "single-click" usage.

To make this procedure work we need the entry GRUB_DEFAULT=saved in /etc/default/grub.


@Takkat has answered the question, but I thought I'd describe a few more details in case it might help others.

  • Boot menus count from zero. I have five elements in my boot menu. The fifth element is Windows, thus, to reboot to Windows, I had to issue the command grub-reboot 4 (i.e., not 5). UPDATE: see comments below about this possibly changing.
  • In order to edit /etc/default/grub I issued sudo vim /etc/default/grub.
  • To make the procedure work, I had to modify the existing value of GRUB_DEFAULT=0 to GRUB_DEFAULT=saved and then run sudo update-grub.

I then created a script based on the webupd8 example:

I called it winboot and put in in ~/bin

gksu grub-reboot 4
gksu reboot
  • Ty for giving us further details. Mind that after the next kernel update you will likely have to change your position number.
    – Takkat
    May 13 '11 at 9:03
  • @Takkat - Would there be a way of auto selecting the lowest line number (I'm assuming Windows is listed last in Grub2) to avoid that problem? @Jeromy - Thanks for posting this up.
    – boehj
    May 13 '11 at 11:33
  • I've not tested this but by using the textual description for Winodws you should be on the safe side.
    – Takkat
    May 13 '11 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.