lscpu

lscpu reports information about the CPU, such as its architecture, vendor identification, virtualization features, cache (L1/L2/L3), and CPU vulnerabilities.

The lscpu command retrieves information about the the CPU architecture. The sources to retrieve this information include /proc/cpuinfo, pseudo file system sysfs, and available libraries.

Examples of information includes:

  • Cores
  • CPUs
    • BogoMIPS
    • Byte order
    • Cache sharing
    • Caches
    • Family
    • Model
    • Stepping
  • NUMA nodes
  • Threads
  • Sockets
  • Virtualization details
  • Vulnerabilities

The tool is both suitable for using in the terminal and manual interpretation, but also for automated processing. When its output is piped to other another application, it is aware that any screen markup should be left out.

With more vulnerabilities begin discovered in CPUs, the tool is also able to show applicable vulnerabilities discovered in the specific CPU architecture.

Example output:

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         40 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  1
  On-line CPU(s) list:   0
Vendor ID:               GenuineIntel
  Model name:            QEMU Virtual CPU version 2.5+
    CPU family:          15
    Model:               107
    Thread(s) per core:  1
    Core(s) per socket:  1
    Socket(s):           1
    Stepping:            1
    BogoMIPS:            6191.99
    Flags:               fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm cpuid_fault pti
Virtualization features: 
  Hypervisor vendor:     KVM
  Virtualization type:   full
Caches (sum of all):     
  L1d:                   32 KiB (1 instance)
  L1i:                   32 KiB (1 instance)
  L2:                    4 MiB (1 instance)
  L3:                    16 MiB (1 instance)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0
Vulnerabilities:         
  Gather data sampling:  Not affected
  Itlb multihit:         KVM: Mitigation: VMX unsupported
  L1tf:                  Mitigation; PTE Inversion
  Mds:                   Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
  Meltdown:              Mitigation; PTI
  Mmio stale data:       Unknown: No mitigations
  Retbleed:              Not affected
  Spec rstack overflow:  Not affected
  Spec store bypass:     Vulnerable
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Retpolines; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Retpoline
  Srbds:                 Not affected
  Tsx async abort:       Not affected

Installation

When lscpu is not installed by default, it can be added to the system using the relevant software package.

Package information for lscpu

Operating systemPackage nameInstallation
AlmaLinuxutil-linux
dnf install util-linux
Arch Linuxutil-linux
pacman -S util-linux
Debianutil-linux
apt install util-linux
Fedorautil-linux
dnf install util-linux
Red Hat Enterprise Linuxutil-linux
dnf install util-linux
Rocky Linuxutil-linux
dnf install util-linux
Ubuntuutil-linux
apt install util-linux

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

Short optionLong optionDescription
-a--allShow online and offline CPUs when used together with -e or -p
-B--bytesUse bytes instead of human-readable format
-bonlineOnly online CPUs, to be used with -e or -p
-C--caches[=list]CPU cache information. List is optional, and can be used for column selection
-c--offlineOnly offline CPUs, to be used with -e or -p
-h--helpShow help
-J--jsonJSON output
-p--parse[=list]Tune output for easier parsing. List is optional, and can be used for column selection
-s--sysroot directoryInspect another Linux instance instead of the active system
-x--hexUse hexadecimal masks
-y--physicalShow physical IDs, which are platform-specific and provided by the kernel.
-v--versionShow lscpu version
--output-allShow all available column, to be combined with --extended (-e), --parse (-p), or --caches (-C)

Missing an option in this overview? Share your feedback.

Relevant articles using the lscpu command

The following articles include an example on how to use lscpu and might be worth further exploring.