1

I am writing a program where I need to know about the machine configuration. Code will run on Linux. I want to find the following:

  1. Number of CPU Cores
  2. Number of CPU Sockets
  3. Number of Disks
  4. If it's a 4 socket processor then which 2 sockets are adjacent to each other

Does Linux expose this information in some file that I can read in to get this information?

What are some good resources to read about such linux internals?

user855
  • 111

1 Answers1

2
Does Linux expose this information in some file that I can read in to get this information?

1. Number of CPU Cores
2. Number of CPU Sockets
3. Number of Disks
4. If it's a 4 socket processor then which 2 sockets are adjacent to each other

Yes, information about CPUs and Disks is available in Linux.

/proc/cpuinfo contains detailed information about the CPU.

e.g. cat /proc/cpuinfo

The command sudo fdisk -l provides a listing of disks and their related information.

This link provides some specifics regarding /proc/cpuinfo.

This link explains the usage and output of sudo fdisk -l.

  • Agreed /proc/cpuinfo is a good place to look for info about CPUs, but user855 asked about disks - lsblk is a better option for that. Where to look for info? tldp, google, /usr/share/doc – symcbean Feb 14 '15 at 00:39