For a CPU summary, use lscpu. For per-core detail, read /proc/cpuinfo. For the exact SKU, use sudo dmidecode -t processor. The three commands answer three different questions. The team that picks the right one for the question has the answer in under five seconds. The team that uses cat /proc/cemifo is wasting time.
Table of contents
- The lscpu command
- The /proc/cpuinfo file
- The dmidecode command for SKU detail
- Reading MHz vs MT/s and turbo vs base
- Multi-socket systems and NUMA topology
- Verifying the kernel sees what the hardware has
- FAQ
The lscpu command
The lscpu command reads from sysfs, /proc/cpuinfo, and architecture-specific libraries, and prints a clean summary. The default output:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
CPU family: 6
Model: 79
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
Caches (sum of all):
L1d: 256 KiB (8 instances)
L1i: 256 KiB (8 instances)
L2: 2 MiB (8 instances)
L3: 35 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
The fields that matter: Architecture (x86_64, aarch64, ppc64le), Model name (the actual SKU), CPU(s) (total logical processors), Core(s) per socket (physical cores), Thread(s) per core (hyperthreading), Socket(s) (physical CPUs).
The math: CPU(s) = Socket(s) × Core(s) per socket × Thread(s) per core. In the example above, 1 × 8 × 2 = 16, which matches CPU(s). The right way to read a CPU spec is to look at all three numbers separately, not just the total.
The /proc/cpuinfo file
The /proc/cpuinfo file is the raw data that lscpu reads. The right use case is per-core detail. The file has one block per logical processor:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
stepping : 1
microcode : 0xb000038
cpu MHz : 1200.000
cache size : 35840 KB
physical id : 0
siblings : 16
core id : 0
cpu cores : 8
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr ...
The fields that matter: cpu MHz is the current frequency (not the max), flags is the full feature set (sse4_2, avx, avx2, aes, sha_ni, etc.), model name is the SKU, physical id is the socket number, core id is the physical core number within the socket.
The right one-liner to get the model name:
grep -m1 'model name' /proc/cpuinfo | cut -d: -f2
The right one-liner to count the CPUs:
grep -c ^processor /proc/cpuinfo
The right one-liner to list the unique flags:
awk '/^flags/{for(i=2;i<=NF;i++)print $i}' /proc/cpuinfo | sort -u
The dmidecode command for SKU detail
The dmidecode command reads the DMI (Desktop Management Interface) table from the system firmware. The -t processor flag filters to the processor section. The output shows the exact SKU, including the part number:
sudo dmidecode -t processor
A typical block:
Processor Information
Socket Designation: CPU 1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
Signature: Type 0, Family 6, Model 79, Stepping 1
Version: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
Voltage: 1.0 V
External Clock: 100 MHz
Max Speed: 4000 MHz
Current Speed: 2400 MHz
Status: Populated, Enabled
Upgrade: Socket LGA2011-3
L1 Cache Handle: 0x0001
L2 Cache Handle: 0x0002
L3 Cache Handle: 0x0003
Serial Number: To Be Filled By O.E.M.
Asset Tag: To Be Filled By O.E.M.
Part Number: To Be Filled By O.E.M.
Core Count: 8
Core Enabled: 8
Thread Count: 16
Characteristics: 64-bit, Multi-Core, Hardware Thread, Execute Protection, Power/Performance Control, Enhanced Virtualization, Performance Monitor,散热 Hardware
The right fields for identifying the CPU: Version (the human-readable SKU), Core Count and Core Enabled (physical cores), Thread Count (logical processors with hyperthreading), Max Speed (the rated turbo frequency), Current Speed (the rated base frequency).
The right answer for ordering replacement CPUs is the Part Number field, which is the OEM’s specific part number. The wrong answer is to use the Version field for ordering, because vendors sell many SKUs with the same nominal speed.
Reading MHz vs MT/s and turbo vs base
Modern CPUs have multiple frequencies: a base frequency, a turbo frequency, and a current frequency that varies based on load and thermal state. The right answer for understanding the numbers is:
model nameincludes the rated base frequency (e.g.,@ 2.40GHz). This is the minimum guaranteed frequency.cpu MHzin/proc/cpuinfois the current frequency. It can be lower than the rated (under load, with power-saving governors) or higher than the rated (with turbo).Max Speedindmidecode -t processoris the maximum turbo frequency.- The actual current frequency is in
/sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq.
The wrong answer is to assume cpu MHz is the rated frequency. The right answer is to look at all three sources and understand which one is which.
The MT/s vs MHz confusion is real. DDR4-3200 transfers at 3200 MT/s but runs at 1600 MHz (because DDR is double data rate). The right answer is to use MT/s when comparing to vendor specs (which usually use MT/s) and MHz when comparing to clock-cycle-based metrics (which use MHz).
Multi-socket systems and NUMA topology
On a multi-socket server, lscpu shows the NUMA topology. A two-socket system has two NUMA nodes, and the right answer for performance-critical workloads is to pin processes to the right socket.
The right one-liner to see the NUMA layout:
numactl --hardware
A typical two-socket output:
available: 2 nodes (0-1)
node 0 cpus: 0 2 4 6 8 10 12 14
node 1 cpus: 1 3 5 7 9 11 13 15
node 0 size: 64366 MB
node 1 size: 64367 MB
node 0 free: 12345 MB
node 1 free: 23456 MB
node distances:
node 0 1
0: 10 20
1: 20 10
The node distances matrix shows the relative cost of accessing memory from each node. A distance of 10 is local, 20 is remote. The right answer for a latency-sensitive workload is to pin to one node and use only that node’s memory. The right answer for a throughput workload is to let the kernel’s automatic NUMA balancing handle it.
Verifying the kernel sees what the hardware has
The right verification is to compare lscpu with nproc and getconf _NPROCESSORS_ONLN. If they all match, the kernel is seeing the right number of CPUs. If they do not match, the kernel is missing CPUs (a CPU is offline, a cgroup limit, a hypervisor configuration).
The right answer for a server that has CPUs offline is to bring them online:
echo 1 | sudo tee /sys/devices/system/cpu/cpu*/online
Or to set the maximum CPU count in the kernel command line:
maxcpus=16
The wrong answer is to assume the missing CPUs are bad hardware. The right answer is to check the kernel logs and the cgroup configuration first.
FAQ
Why is the model name showing @ 2.40GHz but actual MHz is 1200?
Power management. The model name is the rated frequency; cpu MHz is the current frequency. The CPU is down-clocked to save power. The right answer for a benchmark is to set the governor to performance and disable turbo, so the result is reproducible.
What is the difference between cores and threads?
Cores are physical processors. Threads are logical processors that share a physical core (hyperthreading). A 4-core / 8-thread CPU has 4 physical cores, each of which can execute 2 threads simultaneously. The right answer for licensing (some software charges per core) is to count physical cores, not threads. The right answer for performance is to count both, because a single-threaded process uses one thread and a multi-threaded process can use all the threads on a core efficiently.
Why is cpu MHz lower than model name MHz?
The CPU is in a power-saving state. Modern CPUs throttle down when idle. The right answer for a sustained workload is to look at the average MHz over time, not the instantaneous value. The wrong answer is to assume the CPU is broken — the throttling is normal behavior.
Can I see the CPU temperature?
Yes, with lm-sensors. sudo apt install lm-sensors, sudo sensors-detect (walk through the prompts), then sensors shows the current temperatures. The right answer for thermal monitoring in a server is lm-sensors plus a metrics exporter so the data goes to your monitoring system.
Why does my multi-socket box only show one socket in lscpu?
Almost always because the second socket is offline. Check cat /proc/cpuinfo | grep physical | sort -u to see how many physical IDs are present. If only one, the second socket is offline in the BIOS. The right answer is to enable the second socket in the BIOS or to bring it online in the kernel.
What is a CPU stepping?
A stepping is a minor revision of the same CPU model. A Xeon E5-2680 v4 stepping 1 and stepping 2 are the same CPU with different bug fixes or manufacturing improvements. The right answer is to check the stepping for known errata in the CPU’s documentation. The wrong answer is to assume a different stepping is a different CPU.
What about the microcode version?
The microcode version is the firmware revision of the CPU. Updates to microcode fix bugs and security vulnerabilities. The right answer is to keep the microcode up to date — most distros do this automatically through the intel-microcode or amd64-microcode package. The wrong answer is to ignore the microcode version, which leaves known CPU vulnerabilities unpatched.
Can I see the NUMA topology?
Yes, numactl --hardware shows the NUMA nodes, the CPUs in each node, and the memory in each node. The right answer for a performance-critical workload is to use numactl --cpunodebind=0 --membind=0 <command> to pin to one node. The wrong answer is to let the kernel’s default NUMA balancing handle a latency-sensitive workload, which can produce inconsistent results.
If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.
Useful related references: