This question already has an answer here:

I am having Windows and Ubuntu installed side by side. So every time when I boot (when the GRUB menu appears) I have to press down key to select a specific OS.

I want to edit the code of GRUB so that it remembers what I boot last. Like if I boot Ubuntu last time, then by default selected option will be Ubuntu in menu, similarly for windows.

share|improve this question

marked as duplicate by Eliah Kagan, Eric Carvalho, hhlp, Octavian Damiean, Seth Feb 9 '13 at 16:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 13 down vote accepted

You need to set save_default in /etc/default/grub (at the top of the file is OK):

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

After adding these two lines to /etc/default/grub, you then need to update Grub's configuration using this command:

sudo update-grub

This should add the line savedefault at the end of each entry in /boot/grub/grub.cfg.

share|improve this answer

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