Bash One-liner to Set GRUB Timeout

Posted on 02 Jan, 2015 in linux

To set GRUB timeout to 5 seconds, use this command.

sed -i.bak 's/timeout=5/timeout=5/g' /boot/grub/grub.cfg

To disable timeout (first option will be selected automatically) use this command.

sed -i.bak 's/timeout=5/timeout=0/g' /boot/grub/grub.cfg

To halt boot menu until any option is selected, use this one.

sed -i.bak 's/timeout=5/timeout=-1/g' /boot/grub/grub.cfg

If you want to disable creating backup, remove .bak from sed's option. For examlple,

sed -i 's/timeout=5/timeout=1/g' /boot/grub/grub.cfg