$linuxjunkies
>

lscpu(1)

Display information about the CPU architecture and details from /proc/cpuinfo.

UbuntuDebianFedoraArch

Synopsis

lscpu [OPTION]...

Description

lscpu gathers CPU architecture information from /proc/cpuinfo, /proc/meminfo, /proc/stat and other system files. It displays the number of CPUs, cores, threads, cache sizes, CPU flags, and other hardware details in a human-readable format.

Output can be formatted as key-value pairs, JSON, or CSV for easy parsing by scripts. This tool is useful for understanding your system's CPU capabilities, checking core counts for parallel processing, and verifying CPU flags like virtualization support.

Common options

FlagWhat it does
-a, --allinclude lines with empty DATA fields
-b, --onlineprint only online CPUs
-e, --extendedprint extended output with additional columns
-J, --jsonoutput in JSON format
-p, --parse=LISToutput only specified columns (comma-separated)
-s, --sysroot=DIRuse alternative system root directory
-x, --hexprint hexadecimal masks instead of CPU lists
-y, --physicalprint physical IDs instead of logical CPU numbers
-C, --cachesshow cache information
-h, --helpdisplay help message and exit

Examples

Display all CPU architecture information in default key-value format

lscpu

Show total number of logical CPUs available

lscpu | grep 'CPU(s):'

Output CPU information in JSON format for programmatic parsing

lscpu -J

Display only CPU, core, and socket information in columns

lscpu -p=CPU,CORE,SOCKET

Show the CPU model and brand name

lscpu | grep 'Model name'

Display detailed cache hierarchy (L1, L2, L3 sizes and counts)

lscpu -C

Check if CPU supports virtualization (VMX for Intel, SVM for AMD)

lscpu | grep -i 'vmx\|svm'

Print in parseable format with architecture details for scripting

lscpu -p

Related commands