I'm writing a program that displays various system information (on a CentOS system). For example, the processor type and speed (from /proc/cpuinfo), the last boot time (calculated from /proc/uptime), the IP address (from ifconfig output), and a list of installed printers (from lpstat output).
Currently, several pieces of data are obtained from the dmidecode program:
- The platform type (
dmidecode -s system-product-name) - The BIOS version (
dmidecode -s bios-version) - The amount of physical memory (
dmidecode -t17 | grep Size)
These are only available if my program is run as root (because otherwise the dmidecode subprocess fails with a /dev/mem: Permission denied error). Is there an alternative way to get this information, that a normal user can access?
/sys/devices/virtual/dmi/id. Lots of platform-specific information is available there. For a handy script, see https://unix.stackexchange.com/questions/75750/how-can-i-find-the-hardware-model-in-linux/172334#172334 . For system information, your other sentence is good too. There are lots of utilities likefreeor evenhtopthat can get you what you want. – Mike S Oct 25 '17 at 19:35tail: cannot open '/sys/devices/virtual/dmi/id/board_serial' for reading: Permission deniedI got this message. – Salem F Jul 09 '22 at 09:57