🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

lscpu Command

Beginner System Information man(1)

Display CPU architecture information

👁 7 views 📅 Updated: Mar 15, 2026
SYNTAX
lscpu [OPTION]...

What Does lscpu Do?

lscpu displays detailed information about the CPU architecture. It shows the number of CPUs, cores, threads, sockets, cache sizes, CPU model, architecture, and virtualization capabilities.

lscpu reads from /proc/cpuinfo and sysfs, presenting the information in an organized, readable format. It is the go-to command for understanding the CPU configuration of a system.

lscpu is essential for capacity planning, performance tuning, and understanding the hardware you are working with — especially important when sizing workloads for servers.

Options & Flags

OptionDescriptionExample
(no flags) Show CPU information lscpu
-e Extended readable format lscpu -e
-p Parseable format lscpu -p
-J JSON output lscpu -J

Practical Examples

#1 CPU information

Shows complete CPU architecture information.
$ lscpu
Output: Architecture: x86_64 CPU(s): 8 Thread(s) per core: 2 Core(s) per socket: 4 Model name: Intel Core i7-10700

#2 JSON output

Shows CPU info in JSON format for programmatic use.
$ lscpu -J

#3 Extended format

Shows per-CPU information in table format.
$ lscpu -e
Output: CPU NODE SOCKET CORE ONLINE\n0 0 0 0 yes

#4 Quick core count

Shows just the number of available processing units.
$ nproc
Output: 8

#5 Check virtualization

Checks if system is virtualized and what technology is available.
$ lscpu | grep 'Virtualization\|Hypervisor'
Output: Hypervisor vendor: KVM\nVirtualization type: full

Tips & Best Practices

nproc for core count: If you just need the CPU count for make -j or parallelization, use nproc instead of parsing lscpu output.
Threads vs cores: Threads per core > 1 means hyperthreading is enabled. 4 cores with 2 threads = 8 logical CPUs, but only 4 physical cores.
Container CPUs: In containers, lscpu shows host CPU info. Check cgroup limits: cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us for actual available CPU.

Frequently Asked Questions

How do I check the number of CPU cores?
nproc shows available processing units. lscpu shows detailed info including physical cores, threads, and sockets.
How do I check if hyperthreading is enabled?
Look for 'Thread(s) per core' in lscpu output. Value of 2 means hyperthreading is enabled.
How do I check CPU architecture?
lscpu shows Architecture (x86_64, aarch64) and Model name. Or use uname -m for just the architecture.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →