Linux 讀取系統 CPU 資訊 — lscpu

在 Linux 下要讀取系統的 CPU 資訊,最簡單的方法可以透過 lscpu 指令,用法十分簡單,只要直接輸入 lscpu 指令便可以,例如:

$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 26
Stepping: 5
CPU MHz: 2261.236
BogoMIPS: 4522.47
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 4096K
NUMA node0 CPU(s): 0-3

lscpu 會讀取 /proc/cpuinfo 取得所需資訊,透過讀取 /proc/cpuinfo 也可以取得相同的結果:

$ cat /proc/cpuinfo



Leave a Reply