How to detect whether Linux runs in UEFI or BIOS mode inside the Linux?
Posted on In QAHow to detect whether Linux runs in UEFI or BIOS mode inside the Linux itself without needed to boot the the management console of the mother board?
You can detect whether Linux runs in EFI mode by checking whether /sys/firmware/efi
exist. In bash, you can test by
[ -d /sys/firmware/efi/ ]
This technique is used in the grub2-regen-cfg tool: http://www.systutorials.com/136638/how-to-regenerate-grub2-config-file-on-linux/