Site icon DesignLinux

Get CPU Information on Linux Systems

Get CPU Information on Linux

As all we know that the CPU, Central Processing Unit is knows as the brain of computer. It performs all types of data processing operations. In this tutorial we will discuss about to get CPU information on Linux system.

Sometimes you need to know that what CPU you have inside your machine. It’s very easy to determine the processor type and speed using the command line.

Get CPU Information in Linux

It is easy way to show the contents of /proc/cpuinfo virtual file to determine the what type of CPU you have. This method is simple and there’s no required any package to install and it’s same for all Linux distributions.

Open your terminal display contents of /proc/cpuinfo file using cat or less command:

cat /proc/cpuinfo

It will show the logical CPU with identification number. Here, in this example, there are 4 cores processor so it will show list of all cores from 0 to 3.

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 79
model name      : Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
stepping        : 1
microcode       : 0x1
cpu MHz         : 2199.996
cache size      : 4096 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 4
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 mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon rep_good nopl cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap xsaveopt md_clear
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 4399.99
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual

Following are the description for common lines:

You also can filter the output using grep command. For instance, to show only processor name, type:

grep -m 1 'model name' /proc/cpuinfo

It will show output something like below:

model name : Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz

To get the number of CPUs:

grep -c 'model name' /proc/cpuinfo
4

You can get the same number of CPUs using nproc command:

nproc
4

Check CPU Info with lscpu

You can know about the CPU architecture using lscpu command. lscpu is a part of the util-linux package which is installed on all Linux distributions.

On terminal, type lscpu:

lscpu

It should show output something like below:

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:               79
Model name:          Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
Stepping:            1
CPU MHz:             2199.996
BogoMIPS:            4399.99
Virtualization:      VT-x
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            4096K
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 ss syscall nx rdtscp lm constant_tsc arch_perfmon rep_good nopl cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap xsaveopt md_clear

Conclusion

In this guide you learned how to show get CPU information and the know about the CPU structure. You also can use other tools for system monitoring but those are not installed by default on Linux.

If you have any questions or feedback, leave a comment below.

Exit mobile version