Ubuntu – How to list GRUB’s “menuentries” in command-line

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.

"Memory test (memtest86+)"

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.