Command-Line – List GRUB’s Menuentries

command linegrub2

Is there a way of retrieving list of "menuentries" titles of GRUB?

I need a results in a format that grub-set-default will accept. eg.

"Ubuntu"
"Memory test (memtest86+)"
etc.

Best Answer

Using awk

awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg 

gives you a full list of all menu entries in grub.cfg.