Linux Get CPU Information

This post is one of those ‘reminder’ types which is to help me remember the various commands able to retrieve the underlying CPU information on a Linux command line. In this instance the commands were executed on the latest version of Ubuntu server, purely because I happen to have a virtual machine with it installed running right now.

First off we have lscpu.

[email protected]:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 86
Model name: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
Stepping: 3
CPU MHz: 2098.954
BogoMIPS: 4199.99
Hypervisor vendor: VMware
Virtualisation type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 12288K
NUMA node0 CPU(s): 0
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt dtherm ida arat pln pts

 

I can also grab the information via cat /proc/cpuinfo

[email protected]:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 86
model name : Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
stepping : 3
microcode : 0x700000c
cpu MHz : 2098.954
cache size : 12288 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt dtherm ida arat pln pts
bugs :
bogomips : 4199.99
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:

 

Alternatively I could grab the data from the lshw command.

[email protected]:~$ sudo lshw | less

[some data removed for clarity]

*-cpu:0
description: CPU
product: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
vendor: Intel Corp.
physical id: 4
bus info: [email protected]
version: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
slot: CPU 0
size: 2002MHz
capacity: 2002MHz
width: 64 bits
capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt dtherm ida arat pln pts

 

Next up let’s use dmicode.

[email protected]:~$ dmicode

[some data removed for clarity]

Processor Information
Socket Designation: CPU 0
Type: Central Processor
Family: Unknown
Manufacturer: GenuineIntel
ID: 63 06 05 00 FF FB AB 0F
Version: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
Voltage: 3.3 V
External Clock: Unknown
Max Speed: 2002 MHz
Current Speed: 2002 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: Not Provided
L2 Cache Handle: Not Provided
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 1
Core Enabled: 1
Characteristics:
64-bit capable
Execute Protection

 

Not that I will likely use it much but the nproc command lists the number of processors.

[email protected]:~$ nproc
1

 


 

OK that’s all of the ways I can think of right now – feel free to comment if you know of any others, though I should clarify I’m only interested in those which can be done natively and don’t require extra software to be installed.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.