修改Ubuntu12.04和Windows双系统默认启动系统

来源:互联网 发布:域名注册要多少钱 编辑:程序博客网 时间:2024/04/28 05:16

http://www.erikrosado.com/2012/07/how-to-change-default-boot-order-in-linux-based-ubuntu-12-04-lts/

Note: This article is based on Ubuntu 12.04 Precise Pangolin LTS version. However it should work fine in all versions using GRUB2.

Well a lot many of us have a dual booting system setup with one operating system as Ubuntu and the other being Windows 7 in most cases or any other. However the problem Ubuntu beginners face is – getting used to it. The geeky linux culture is a bit of a daunting task to get used to, but then again, once used to it, people never turn back on open source.

How many times have you wanted to boot into Windows but forgot to select Windows in the boot menu or may be (in rare cases) ran out of time before you did that. Believe me, i’m one of such dreamy busy guys. After repeatedly booting into Ubuntu and restarting my system again only to get back to Windows, I was done. I set my mind, opened up the legendary Google Search page and typed ‘how to change boot order in ubuntu’. That’s it..! It was a piece of cake. Read on to know how i did it.

To change the default boot operating system, we have to first know its position. To know this, on your boot screen start counting from 0. That is, the first entry is numbered 0 and the last entry, Windows 7 in my case, is numbered 4【我的是5】. We will call this the boot-number.


First things first. Let me make you people clear that there are many small programs that do this in a jiffy. But what’s the fun in running applications in linux systems..? So lets get a bit more geeky and open up your ubuntu terminal by pressing Ctrl+T on your keyboard.

The file that needs our attention now is the ‘grub’ (GRUB: Grand Unified Bootloader) located in ‘/etc/default’. Before we make any changes to this file, lets take a backup of it. To do this, in the terminal, type the following command and hit enter.

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

 Note: There is a space between ‘cp’ & ‘etc/default/grub’ and ‘/etc/default/grub’ & /etc/default/grub.bak’

It may ask for the account password. And the password won’t be visible when typed (as you can see in the above image). Just type the password and hit enter. ’cp’ is a command to copy files through terminal.

That ends the backup thing. Now lets complete our mission. In the terminal, type and execute

gksu gedit /etc/default/grub

This opens up the grub file in which the changes are to be made.

Now change boot-number in ‘GRUB_DEFAULT’ field (highlighted in the image below) from 0 to 4【我的是5.可以数出来的,从上到下0开始数,在第几个就是几】, so that Windows 7 becomes the default operating system to boot into.

In case, if the time to select your option isn’t sufficient for you in the boot screen, you can change it by changing the default 10 seconds in ‘GRUB_TIMEOUT’ field to any number of seconds you like.

Now save the file and come back to the terminal.


To update these new booting rules, type and execute

sudo update-grub

That’s it! Piece of cake isn’t it?

In case something goes wrong, replace the edited file with the backed up file by executing

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

Nothing went wrong in my case though



0 0
原创粉丝点击