Saturday, December 23, 2017

grub2 - How to list GRUB's "menuentries" in command-line?



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.



Using awk



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


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


No comments:

Post a Comment