One approach is to parse the default kernel from GRUB configurations. The default GRUB menu entry can be detected, for example:

grep GRUB_DEFAULT /etc/default/grub | cut -d '=' -f 2

Then get the menu entries from GRUB config, like:

grep -A 15 '^menuentry' /boot/grub/grub.cfg | grep -o -P 'vmlinuz-\S+'

Source: How to get the kernel version of the next boot from a script – Unix & Linux Stack Exchange

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.