CPU Information
How many cores? What speed? Is the CPU maxed out? Let's find out.
lscpu - CPU Overview
Key fields:
- CPU(s): Total logical CPUs (cores × threads)
- Core(s) per socket: Physical cores
- Thread(s) per core: Hyperthreading (usually 2)
- Socket(s): Physical CPU chips
Cores vs Threads
A 4-core CPU with hyperthreading shows as 8 CPUs. Physical cores matter most for CPU-bound work.
/proc/cpuinfo
Detailed info for each CPU:
Quick Core Count
nproc gives total available CPUs - useful in scripts.
CPU Usage
Instant Check
Load average: 1, 5, 15 minute averages.
Real-time with top
CPU breakdown:
| Code | Meaning |
|---|---|
| us | User processes |
| sy | System (kernel) |
| ni | Nice (low priority) |
| id | Idle |
| wa | I/O wait |
| hi | Hardware interrupts |
| si | Software interrupts |
High wa means CPU is waiting for slow disk.
Per-Process
mpstat - Per-Core Stats
This shows if one core is maxed while others are idle (single-threaded bottleneck).
A server shows 4 CPUs with lscpu. The load average is 2.0. Is this concerning?
Quick Reference
| Command | Shows |
|---|---|
lscpu | CPU specifications |
nproc | Number of CPUs |
/proc/cpuinfo | Detailed CPU info |
uptime | Load averages |
top then 1 | Per-core usage |
mpstat -P ALL | Per-core statistics |
Key Takeaways
lscpushows CPU specificationsnprocgives CPU count for scripts- Load average should be compared to core count
- High
wa(I/O wait) indicates disk bottleneck - Use
topwith1key to see per-core usage
Next: reading system logs.