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?

migrated from serverfault.com Feb 13 '15 at 22:47

This question came from our site for system and network administrators.

  • 1
    dmidecode, lshw, lscpu, lsblk, inxi ... – Costas Feb 13 '15 at 23:37
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 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.