How To Get CPU Information on Linux
This post will guide you how to get cpu information on your Linux operaing systems. How do I dertermine the number of cpu cores in your Linux system. How to find out CPU sockets from the command line on Linux.
Displaying CPU Information
If you want to get the information of your systemc CPU on your Linux system, and you can print the content of the /proc/cpuinfo file using cat command, type:
$ cat /proc/cpuinfo
Outputs:
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
stepping : 10
cpu MHz : 1800.001
cache size : 6144 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt flush_l1d
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips : 3600.00
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
If you want to get vendor name of you system cpu, and you can redirect the standard output of the above cat command to grep command to get the vendor name, type:
$ cat /proc/cpuinfo | grep 'vendor'
Outputs:
[root@localhost ~]# cat /proc/cpuinfo | grep 'vendor'
vendor_id : GenuineIntel
You can also use another tool called lscpu to dispaly information about the CPU architecture at the shell prompt in your Linux system, type:
$ lscpu
Outputs:
[root@localhost ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
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: 142
Model name: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Stepping: 10
CPU MHz: 1800.001
BogoMIPS: 3600.00
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt flush_l1d
If you want to determine the number of CPU sockets on your current Linux system, and you can use one of the following commands:
$ grep "physical id" /proc/cpuinfo | wc -l
or
$ lscpu | grep -i "socket(s)"
Outputs:
[root@localhost ~]# grep "physical id" /proc/cpuinfo | wc -l 1 [root@localhost ~]# lscpu | grep -i "socket(s)" Socket(s): 1 [root@localhost ~]#
You can also use another tool called dmidecode to print the entries of type processor using the following command:
$ dmidecode --type processor
Outputs:
[root@osetc ~]# dmidecode --type processor
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.
Handle 0x0400, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU 0
Type: Central Processor
Family: Other
Manufacturer: QEMU
ID: D2 06 03 00 FF FB 8B 07
Version: pc-i440fx-3.0
Voltage: Unknown
External Clock: Unknown
Max Speed: 2000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
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
Thread Count: 1
Characteristics: None
Conclusion
You should know that how to check CPU information using cat/lscpu/dmidecode commands in CentOS or RHEL or Ubuntu Linux system.