Skip to main content
Tips

5 Ways to Check CPU Info in Linux

Here are multiple ways you can get CPU information in Linux command line. You can get processor information like the number of real cores, logical cores, hyperthreading, CPU frequency etc.

Abhishek Prakash

Warp Terminal

There are a number of ways you can get information about the processor on your Linux system. I’ll show you my favorite tool for this task along with a few additional ways to check CPUs in Linux.

Get CPU info with lscpu command

This is the simplest command that shows the CPU information in a simple and concise output.

You can see the architecture of your system, number of processors, vendor information, cache information, processor speed etc.

It’s easier to remember as well because it is similar to the ls command. You can think of it as ‘list cpu’.

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:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               142
Model name:          Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Stepping:            9
CPU MHz:             900.054
CPU max MHz:         3100.0000
CPU min MHz:         400.0000
BogoMIPS:            5424.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            3072K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d

Well… that’s the processor information for my system and it should look somewhat similar for your Linux system as well.

As you can see, the most important information is that my system has Intel i5-7200U processor. I can go and search on the web for this model number to get more information.

But what does other fields in the output mean? What information do you really have about the processor here? Let me explain it to you. The information is too technical so you should have some basic understanding of the terms here.

lscpu command output explanation

The architecture for my system is 64-bit. Which means it’s a 64-bit processor.

The CPU op-mods are 32 bit and 64 bit meaning that it can operate both as a 32-bit and 64-bit processor. In other words, you can install both 32-bit and 64-bit operating systems on it.

Byte order is Little Endian. Which means that bytes are arranged as per Little Endian order.

The next 4 lines tells you about the number of processors, CPUs/cores and threads. I would suggest reading this article to understand a bit about processors. This picture from Intel also helps in visualizing what socket, CPU, core, threads mean.

Image Source: Intel

We have to go in the reverse order here. My system has 1 socket here which means it has one single chip for the CPUs.

That one socket has 2 cores. It means that the single chip has two physical CPUs on it. This tells you the number of real cores i.e. the actual physical CPUs.

And as you can see, each core has two threads. Threads are basically logical CPUs. The threads share physical execution resources of the physical core but the operating system sees them as separate cores. Read more on hyper- threading here.

In short, my system has one chip that contains two physical CPUs and each CPU is divided into two logical CPUs. And thus my dual core system is seen as having 4 CPUs by the operating system.

There is one NUMA node, the vendor is Intel and the CPU family is 6.

The CPU model number is 142 (not relevant in my opinion) and the model name is Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (most important info).

Stepping is a number used by Intel to identify what level of design change a microprocessor was built to.

The current clock speed of my CPU is 900.054 MHz whereas its maximum capacity is 3100 MHz and 400 MHz.

BogoMIPS is “the number of million times per second a processor can do absolutely nothing”.

Virtualization is VT-x and is used to “help accelerate virtual machines created in VirtualBox, VMware, Hyper-V, and other apps”.

The next four entries are about cache. It has L1D (data cache) of 32K, L1I (instruction cache) of 32K, L2 cache of 256K and L3 cache of 3072K. Read this wiki page to get quick info on CPU caches.

Next is NUMA node for each CPU (both logical and physical CPUs).

The last line is the list of feature flags that are manufacturer specific. You may read more about them here.

This picture summarizes the most important processor information you get from the lscpu command.

Essential CPU information in Linux

In my opinion, lscpu command is more than enough to give you all the information you need.

Other commands to check CPU information in Linux

There are other ways to get CPU info in Linux command line. Let me show them one by one. However, I won’t go in detail to explain their output.

1. Check the content of /proc/cpuinfo

If you are aware of the directory structure in Linux, you already know that proc is a special directory in Linux. It’s actually a virtual filesystem that contains runtime system information such as system memory, devices mounted, hardware configuration etc.

If you want CPU information, you can read the content of the cpuinfo file in proc directory.

You would note that cpuinfo file has detailed information on each core of the processor.

For example, the first core of my CPU has the following information:

processor    : 0
 vendor_id    : GenuineIntel
 cpu family    : 6
 model        : 142
 model name    : Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
 stepping    : 9
 microcode    : 0x8e
 cpu MHz        : 800.026
 cache size    : 3072 KB
 physical id    : 0
 siblings    : 4
 core id        : 0
 cpu cores    : 2
 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d
 bugs        : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf
 bogomips    : 5424.00
 clflush size    : 64
 cache_alignment    : 64
 address sizes    : 39 bits physical, 48 bits virtual
 power management:

If you just want to number of CPU cores (including both physical and logical ones), you can use the grep command with the wc command.

cat /proc/cpuinfo | grep processor | wc -l

4

2. Use lshw command

lshw stands for ‘list hardware’. Quite obviously, it means to list the hardware information.

Since the lshw command provides information about all the hardware on your system, it will be difficult to find exactly what you are looking for.

This is why lshw command provides option to narrow down your intended search.

To show only the processor information, you can use the lshw command in the following way:

sudo lshw -class CPU

This will show an output like this:

*-cpu                     
        description: CPU
        product: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
        vendor: Intel Corp.
        physical id: 3f
        bus info: cpu@0
        version: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
        serial: To Be Filled By O.E.M.
        slot: U3E1
        size: 2964MHz
        capacity: 3100MHz
        width: 64 bits
        clock: 100MHz
        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 acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d cpufreq
        configuration: cores=2 enabledcores=2 threads=4

3. Use hwinfo

hwinfo is another command line tool to get hardware information of your Linux system.

You probably have to install hwinfo tool first. On Debian and Ubuntu, you can use the apt command to install it.

sudo apt install hwinfo

Once installed, you can get the CPU details in this way:

hwinfo --cpu

You’ll see an output similar to this for each core of the CPU:

01: None 00.0: 10103 CPU                                        
   [Created at cpu.460]
   Unique ID: rdCR.j8NaKXDZtZ6
   Hardware Class: cpu
   Arch: X86-64
   Vendor: "GenuineIntel"
   Model: 6.142.9 "Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz"
   Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,pdpe1gb,rdtscp,lm,constant_tsc,art,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,cpuid,aperfmperf,tsc_known_freq,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,sdbg,fma,cx16,xtpr,pdcm,pcid,sse4_1,sse4_2,x2apic,movbe,popcnt,tsc_deadline_timer,aes,xsave,avx,f16c,rdrand,lahf_lm,abm,3dnowprefetch,cpuid_fault,epb,invpcid_single,pti,ssbd,ibrs,ibpb,stibp,tpr_shadow,vnmi,flexpriority,ept,vpid,fsgsbase,tsc_adjust,bmi1,avx2,smep,bmi2,erms,invpcid,mpx,rdseed,adx,smap,clflushopt,intel_pt,xsaveopt,xsavec,xgetbv1,xsaves,dtherm,ida,arat,pln,pts,hwp,hwp_notify,hwp_act_window,hwp_epp,flush_l1d
   Clock: 3050 MHz
   BogoMips: 5424.00
   Cache: 3072 kb
   Units/Processor: 16
   Config Status: cfg=new, avail=yes, need=no, active=unknown

4. dmidecode Command

dmidecode is another command to retrieve various kind of hardware information of your Linux system. You can check memory usage in Linux with it. You can also use it to get only the processor information.

sudo dmidecode --type processor

This command needs sudo access as well. You’ll see an output like this:

dmidecode 3.1
 Getting SMBIOS data from sysfs.
 SMBIOS 3.0.0 present.
 Handle 0x003F, DMI type 4, 48 bytes
 Processor Information
     Socket Designation: U3E1
     Type: Central Processor
     Family: Core i5
     Manufacturer: Intel(R) Corporation
     ID: E9 06 08 00 FF FB EB BF
     Signature: Type 0, Family 6, Model 142, Stepping 9
     Flags:
         FPU (Floating-point unit on-chip)
         VME (Virtual mode extension)
         DE (Debugging extension)
         PSE (Page size extension)
         TSC (Time stamp counter)
         MSR (Model specific registers)
         PAE (Physical address extension)
         MCE (Machine check exception)
         CX8 (CMPXCHG8 instruction supported)
         APIC (On-chip APIC hardware supported)
         SEP (Fast system call)
         MTRR (Memory type range registers)
         PGE (Page global enable)
         MCA (Machine check architecture)
         CMOV (Conditional move instruction supported)
         PAT (Page attribute table)
         PSE-36 (36-bit page size extension)
         CLFSH (CLFLUSH instruction supported)
         DS (Debug store)
         ACPI (ACPI supported)
         MMX (MMX technology supported)
         FXSR (FXSAVE and FXSTOR instructions supported)
         SSE (Streaming SIMD extensions)
         SSE2 (Streaming SIMD extensions 2)
         SS (Self-snoop)
         HTT (Multi-threading)
         TM (Thermal monitor supported)
         PBE (Pending break enabled)
     Version: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
     Voltage: 0.8 V
     External Clock: 100 MHz
     Max Speed: 2500 MHz
     Current Speed: 2400 MHz
     Status: Populated, Enabled
     Upgrade: Other
     L1 Cache Handle: 0x003C
     L2 Cache Handle: 0x003D
     L3 Cache Handle: 0x003E
     Serial Number: To Be Filled By O.E.M.
     Asset Tag: To Be Filled By O.E.M.
     Part Number: To Be Filled By O.E.M.
     Core Count: 2
     Core Enabled: 2
     Thread Count: 4
     Characteristics:
         64-bit capable
         Multi-Core
         Hardware Thread
         Execute Protection
         Enhanced Virtualization
         Power/Performance Control

Conclusion

Of course, there are many more tools that provide you hardware information in Linux. You can utilize them to get CPU info as well.

In my opinion, lscpu is the best command if you don’t want to remember anything. You can also rely on /proc/cpuinfo file. Just use these two and you’ll be set.

Since you learned to check CPU info, maybe you would like to read about checking the disk info in Linux as well.

I hope you liked this tutorial. If you have questions or suggestions, please leave a comment below.

Abhishek Prakash