Skip to content

How To: Remember the Last Boot Selection in GRUB#

If you have a dual-boot system with Linux and Windows OS, you probably have GRUB installed as a bootloader.

Now, if you wanted Grub to remember the last selected OS rather than booting the default OS or the first entry in the table, you can tell grub by editing the grub settings.

Proceed as follows:

  1. Boot into Linux, e.g., Ubuntu, and open a terminal.
  2. Edit the Grub settings:
    sudo nano /etc/default/grub
    
  3. Comment out the line with GRUB_DEFAULT=0 (or whatever number) and replace it by:
    #GRUB_DEFAULT=0
    GRUB_DEFAULT=saved
    GRUB_SAVEDEFAULT=true
    
  4. Save the file and update Grub by typing:
    sudo update-grub
    
  5. (Only if applicable) If update-grub is not available:
    sudo grub-mkconfig -o /boot/grub/grub.cfg
    

Now, if you reboot from within Windows, Windows will be booted. This also applies to Ubuntu.

Back to Knowledge Articles