Display CPU information.

Display CPU information.

$ 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):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           165
Model name:                      Intel(R) Core(TM) i3-10105 CPU @ 3.70GHz
Stepping:                        3
CPU MHz:                         800.008
CPU max MHz:                     4400.0000
CPU min MHz:                     800.0000
BogoMIPS:                        7399.70
Virtualization:                  VT-x
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        6 MiB
NUMA node0 CPU(s):               0-7
Vulnerability Itlb multihit:     KVM: Mitigation: VMX disabled
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
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 p
                                 ni 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 ssbd ibrs ibpb stibp ibr
                                 s_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad 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 
                                 md_clear flush_l1d arch_capabilities
$ lscpu  --json
{
   "lscpu": [
      {"field":"Architecture:", "data":"x86_64"},
      {"field":"CPU op-mode(s):", "data":"32-bit, 64-bit"},
      {"field":"Byte Order:", "data":"Little Endian"},
      {"field":"Address sizes:", "data":"39 bits physical, 48 bits virtual"},
      {"field":"CPU(s):", "data":"8"},
      {"field":"On-line CPU(s) list:", "data":"0-7"},
      {"field":"Thread(s) per core:", "data":"2"},
      {"field":"Core(s) per socket:", "data":"4"},
      {"field":"Socket(s):", "data":"1"},
      {"field":"NUMA node(s):", "data":"1"},
      {"field":"Vendor ID:", "data":"GenuineIntel"},
      {"field":"CPU family:", "data":"6"},
      {"field":"Model:", "data":"165"},
      {"field":"Model name:", "data":"Intel(R) Core(TM) i3-10105 CPU @ 3.70GHz"},
      {"field":"Stepping:", "data":"3"},
      {"field":"CPU MHz:", "data":"3700.000"},
      {"field":"CPU max MHz:", "data":"4400.0000"},
      {"field":"CPU min MHz:", "data":"800.0000"},
      {"field":"BogoMIPS:", "data":"7399.70"},
      {"field":"Virtualization:", "data":"VT-x"},
      {"field":"L1d cache:", "data":"128 KiB"},
      {"field":"L1i cache:", "data":"128 KiB"},
      {"field":"L2 cache:", "data":"1 MiB"},
      {"field":"L3 cache:", "data":"6 MiB"},
      {"field":"NUMA node0 CPU(s):", "data":"0-7"},
      {"field":"Vulnerability Itlb multihit:", "data":"KVM: Mitigation: VMX disabled"},
      {"field":"Vulnerability L1tf:", "data":"Not affected"},
      {"field":"Vulnerability Mds:", "data":"Not affected"},
      {"field":"Vulnerability Meltdown:", "data":"Not affected"},
      {"field":"Vulnerability Spec store bypass:", "data":"Mitigation; Speculative Store Bypass disabled via prctl and seccomp"},
      {"field":"Vulnerability Spectre v1:", "data":"Mitigation; usercopy/swapgs barriers and __user pointer sanitization"},
      {"field":"Vulnerability Spectre v2:", "data":"Mitigation; Enhanced IBRS, IBPB conditional, RSB filling"},
      {"field":"Vulnerability Srbds:", "data":"Not affected"},
      {"field":"Vulnerability Tsx async abort:", "data":"Not affected"},
      {"field":"Flags:", "data":"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 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 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad 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 md_clear flush_l1d arch_capabilities"}
   ]
}

Extract specific CPU field.

$ lscpu --json | jq --raw-output '.lscpu[] | select(.field=="CPU MHz:") | .data'
3700.000

Inspect specific CPU flag.

$ lscpu --json | jq --raw-output '.lscpu[] | select(.field=="Flags:") | .data | split(" ") | any(match("^lm$"))'
true

Display extended output.

$ lscpu  --extended --output-all
CPU CORE SOCKET NODE BOOK DRAWER L1d:L1i:L2:L3 POLARIZATION ADDRESS CONFIGURED ONLINE    MAXMHZ   MINMHZ
  0    0      0    0    -      - 0:0:0:0       -            -       -             yes 4400.0000 800.0000
  1    1      0    0    -      - 1:1:1:0       -            -       -             yes 4400.0000 800.0000
  2    2      0    0    -      - 2:2:2:0       -            -       -             yes 4400.0000 800.0000
  3    3      0    0    -      - 3:3:3:0       -            -       -             yes 4400.0000 800.0000
  4    0      0    0    -      - 0:0:0:0       -            -       -             yes 4400.0000 800.0000
  5    1      0    0    -      - 1:1:1:0       -            -       -             yes 4400.0000 800.0000
  6    2      0    0    -      - 2:2:2:0       -            -       -             yes 4400.0000 800.0000
  7    3      0    0    -      - 3:3:3:0       -            -       -             yes 4400.0000 800.0000

Display parsable output.

$ lscpu  --parse --output-all
# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
# starting from zero.
# CPU,Core,Socket,Node,Book,Drawer,L1d:L1i:L2:L3,Polarization,Address,Configured,Online,Maxmhz,Minmhz
0,0,0,0,,,0:0:0:0,,,,Y,4400.0000,800.0000
1,1,0,0,,,1:1:1:0,,,,Y,4400.0000,800.0000
2,2,0,0,,,2:2:2:0,,,,Y,4400.0000,800.0000
3,3,0,0,,,3:3:3:0,,,,Y,4400.0000,800.0000
4,0,0,0,,,0:0:0:0,,,,Y,4400.0000,800.0000
5,1,0,0,,,1:1:1:0,,,,Y,4400.0000,800.0000
6,2,0,0,,,2:2:2:0,,,,Y,4400.0000,800.0000
7,3,0,0,,,3:3:3:0,,,,Y,4400.0000,800.0000

Extended and parsable output can be customized to display only selected columns.

$ lscpu  --extended=cpu,core,socket,node,online,minmhz,maxmhz
CPU CORE SOCKET NODE ONLINE   MINMHZ    MAXMHZ
  0    0      0    0    yes 800.0000 4400.0000
  1    1      0    0    yes 800.0000 4400.0000
  2    2      0    0    yes 800.0000 4400.0000
  3    3      0    0    yes 800.0000 4400.0000
  4    0      0    0    yes 800.0000 4400.0000
  5    1      0    0    yes 800.0000 4400.0000
  6    2      0    0    yes 800.0000 4400.0000
  7    3      0    0    yes 800.0000 4400.0000