How to switch boot order within Windows & Linux

If you have both Windows and Linux installed on your computer, default  booting operating system would be Linux.
If you are frequent Windows user than Linux, the default booting OS(Operating System) should be Windows else you will waste time in every time choose boot to Windows.
Note that to change the boot sequence you will require the root level access as you are going to modify "/boot/grub/grub.cfg".
If you are using x windows system, open the file "/boot/grub/grub.cfg" using any text editor. If you don't have root level access then open text editor using sudo command as:
sudo -u root gedit 
Then open the file grub.cfg. In the grub.cfg search for "menuentry" and check for menuentry having "Windows " loader line.
Count the number of menuentries before Windows entry. Do not count Windows entry as menu entry start from 0. Set the counted value at:
set default="0" 
in the grub.cfg file as set default="5" now save the grub.cfg file and you are done. Just restart the computer and check if the changes are reflected on boot loader.
Alternatively you can do above easily with terminal as below.
  • Open the terminal by pressing buttons "Ctrl + Alt + T" ( Control + Alt + T). 
  • On terminal type following command:
           cat /boot/grub/grub.cfg | grep menuentry
  • This will print output as below 
  
  • Count the menuentry till the Windows entry. The counting should start from 0.
  • Now edit the file using command sudo -u root vi /boot/grub/grub.cfg
  • Update the counted value instead of set default="0" as lets say in above case it is 8 so, set default="5".
  • Save the file, and restart the computer. 
Note: While counting for "menuentry" make sure that count one menuentry for all "menuentry" present under submenu such as in above image submenu "Previous Linux versions"{ }. For this you will have to open file in text editor or cat completed file on terminal, to check what entries present under Submenu.

No comments:

Post a Comment

Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...