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 system | Package name | Installation |
---|---|---|
AlmaLinux | util-linux |
|
Arch Linux | util-linux |
|
Debian | util-linux |
|
Fedora | util-linux |
|
Red Hat Enterprise Linux | util-linux |
|
Rocky Linux | util-linux |
|
Ubuntu | util-linux |
|
Your Linux distribution using a different package? Share your feedback.
Usage
Available options
Short option | Long option | Description |
---|---|---|
-a | --all | Show online and offline CPUs when used together with -e or -p |
-B | --bytes | Use bytes instead of human-readable format |
-b | online | Only 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 | --offline | Only offline CPUs, to be used with -e or -p |
-h | --help | Show help |
-J | --json | JSON output |
-p | --parse[=list] | Tune output for easier parsing. List is optional, and can be used for column selection |
-s | --sysroot directory | Inspect another Linux instance instead of the active system |
-x | --hex | Use hexadecimal masks |
-y | --physical | Show physical IDs, which are platform-specific and provided by the kernel. |
-v | --version | Show lscpu version |
--output-all | Show 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.