Wednesday, August 21, 2013

Change default OS the hacker way

Well I had played with grub.cfg long time back but recently I had to install Ubuntu on my laptop which I rarely use ( as I believe kick ass developers don't work on laptop :P ) and especially with window$ on it.

So anyway , I installed Ubuntu but forgot to set the default OS to window$  , well you might be like


Yeah yeah , I tried persuading my family members to use Ubuntu but soon gave up on them :P.

A very shiny pearl of wisdom I have picked up is that , always create a backup of any config file you plan on tweaking.

So lets go ahead and make a original backup of the /boot/grub/grub.cfg file which will be changed to reset the default options.


  • cd /boot/grub/
  • sudo cp grub.cfg grub.cfg.org
  • sudo vim grub.cfg
  • search for set default with vim search i.e "/set default" this is generally line 13 in grub.cfg
  • All the entries in the grub are associated with "menuentry" keyword in grub.cfg , for setting the default to windows OS we need to find the menuentry number for windows , these menuentry  starts with 0. If you are dual booted there are high chances that menuentry for windows would be 4.
    here in my case it has to be 4 , so I can change my default OS to window$ by pointing the default to 4.
  • change the set default to the corresponding OS menuentry , for me it is 


    • set default = "4"
    • optionally while you are at it , you can even make the booting faster by changing the default time out to 2 sec or so.
You can always use GUI grub config tools but 

No comments:

Post a Comment