Results 1 to 4 of 4

Thread: Howto generate text file of Boot menu - output of grub.cfg

  1. #1
    Join Date
    Dec 2008
    Location
    W-slp-Sierra Nevada usa
    Beans
    1,401
    Distro
    Ubuntu 14.04 Trusty Tahr

    Howto generate text file of Boot menu - output of grub.cfg

    Hi, I'd like to have a text file of the boot menu generated by /boot/grub/grub.cfg. Haven't figured out how to make grub.cfg run and use pipe to a file.

    Thanks in advance

    Edit: Oh, I already know, shouda put a question mark in the Subject line!
    boot_info_script by meierfra & Gert Hulselmans
    unetbootin to burn liveCD/USB
    Repair Windows7 Boot
    Partitioning

  2. #2
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Howto generate text file of Boot menu - output of grub.cfg

    I always just run boot script. In fact is it part of my rsync backup so I always have a current one even though it does not change that much.

    If you just want titles:

    List of grub menu:
    grep menuentry /boot/grub/grub.cfg
    or numbered list:
    grep menuentry /boot/grub/grub.cfg | cut -b 1-11 --complement | cut -d "'" -f1 | cut -d "\"" -f 1 | nl --starting-line-number=0

    Code:
    fred@fred-MavericDT:~$ grep menuentry /boot/grub/grub.cfg | cut -b 1-11 --complement | cut -d "'" -f1 | cut -d "\"" -f 1 | nl --starting-line-number=0
         0    Ubuntu, with Linux 2.6.35-30-generic
         1    Ubuntu, with Linux 2.6.35-30-generic (recovery mode)
         2    Ubuntu, with Linux 2.6.35-28-generic
         3    Ubuntu, with Linux 2.6.35-28-generic (recovery mode)
         4    Ubuntu, with Linux 2.6.35-23-generic
         5    Ubuntu, with Linux 2.6.35-23-generic (recovery mode)
         6    Memory test (memtest86+)
         7    Memory test (memtest86+, serial console 115200)
         8     
         9    Microsoft Windows XP Professional (on /dev/sda1)
        10     
        11    Kubuntu, Natty 11.04 (on /dev/sdc11)
        12    Ubuntu, Oneiric 11.10 (on /dev/sdc16)
        13    Ubuntu, Natty 11.04 (on /dev/sdc13)
        14     
        15    Ubuntu, Lucid 10.04 (on /dev/sdc7)
        16    Karmic 9.10 on sdc5 (on /dev/sdc5)
        17    Puppy 511
        18    Chainboot hd2
        19     
        20    Chainboot hd1
        21    Chainload Other Systems Grub Menu on sdc1
        22    Kubuntu 11.04 Natty ISO 64bit
        23    gparted (Boot ISO Image via Grub2) 
        24    Reboot
        25    Halt
    fred@fred-MavericDT:~$
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  3. #3
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Howto generate text file of Boot menu - output of grub.cfg

    Something like
    Code:
    awk -F[\'\"] '/^menuentry/{print $2}' /boot/grub/grub.cfg
    ?

    Code:
    awk -F[\'\"] '/^menuentry/{print $2}' /boot/grub/grub.cfg > ~/grub.menu

  4. #4
    Join Date
    Dec 2008
    Location
    W-slp-Sierra Nevada usa
    Beans
    1,401
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Howto generate text file of Boot menu - output of grub.cfg

    Thanks to both of you: oldfred & sisco311. That was quick and painless. I have some command lines and switches to figure out too now!
    boot_info_script by meierfra & Gert Hulselmans
    unetbootin to burn liveCD/USB
    Repair Windows7 Boot
    Partitioning

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •