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?

1
  • 1
    dmidecode, lshw, lscpu, lsblk, inxi ...
    – Costas
    Feb 13, 2015 at 23:37

1 Answer 1

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.

1
  • 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, 2015 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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