lscpuShow CPU architecture, cores, threads and caches
lscpu summarises the CPUs the kernel sees: architecture, model, how many logical CPUs, cores per socket and threads per core, NUMA layout, caches and virtualisation. It answers 'how many cores does this box really have?' when you size worker pools, JVM threads or Kubernetes requests.
lscpu [-e[=LIST]] [-p[=LIST]] [-J] [-y]You're sizing a worker pool on a new VM and need to know what kind of CPU it has and how many.
lscpuutil-linux lscpu: reads /proc/cpuinfo and /sys/devices/system/cpu and prints a summary.
lscpu doesn't probe the hardware itself. It reads what the kernel already discovered: /proc/cpuinfo for vendor, model, flags and BogoMIPS, and sysfs for topology: /sys/devices/system/cpu/cpuN/topology (core_id, package id, thread siblings), cache/indexN for cache sizes and sharing, online and possible CPU lists, and the NUMA node directories. It also runs the CPUID instruction to detect a hypervisor. Each 'CPU' in the CPU(s) line is a logical CPU, a hardware thread the scheduler can use; CPU(s) = sockets x cores per socket x threads per core. On cloud VMs a vCPU is usually one hyperthread, so 4 vCPUs are often 2 physical cores. In a container, lscpu and nproc show the host's CPUs; a CPU limit set with a cgroup quota is not visible here.
(none)Human-readable summary-eOne row per logical CPU: CPU, NODE, SOCKET, CORE, caches, ONLINE-pParsable CSV-style output for scripts-JJSON output-CCache details: size, ways, level, sharing-yShow physical IDs instead of logical onesnprocCompanion: number of CPUs this process may use (affinity)/proc/cpuinfoRaw per-CPU data that lscpu summarisesTreating '4 vCPU' as 4 physical coresOn most cloud instances a vCPU is one hyperthread; two vCPUs share one core's execution units.
Check Thread(s) per core and Core(s) per socket in lscpuSizing a container's thread pool with nproc or lscpu inside itA --cpus or Kubernetes CPU limit is a CFS quota, invisible to nproc and lscpu, which report the host's CPUs.
Read /sys/fs/cgroup/cpu.max, or set the pool size explicitlyUsing BogoMIPS to compare CPU speedBogoMIPS is a calibration loop for kernel delays, not a benchmark.
Compare model names and run a real benchmark of your workloadTry these on a Linux machine of your own. Each task has a hint and a solution.
Find how many logical CPUs, cores per socket and threads per core this machine has.
Show one row per logical CPU with its core and socket.
Compare nproc with the number of 'processor' entries in /proc/cpuinfo.
lscpuShow CPU architecture, cores, threads and caches
lscpu summarises the CPUs the kernel sees: architecture, model, how many logical CPUs, cores per socket and threads per core, NUMA layout, caches and virtualisation. It answers 'how many cores does this box really have?' when you size worker pools, JVM threads or Kubernetes requests.
lscpu [-e[=LIST]] [-p[=LIST]] [-J] [-y]You're sizing a worker pool on a new VM and need to know what kind of CPU it has and how many.
lscpuutil-linux lscpu: reads /proc/cpuinfo and /sys/devices/system/cpu and prints a summary.
lscpu doesn't probe the hardware itself. It reads what the kernel already discovered: /proc/cpuinfo for vendor, model, flags and BogoMIPS, and sysfs for topology: /sys/devices/system/cpu/cpuN/topology (core_id, package id, thread siblings), cache/indexN for cache sizes and sharing, online and possible CPU lists, and the NUMA node directories. It also runs the CPUID instruction to detect a hypervisor. Each 'CPU' in the CPU(s) line is a logical CPU, a hardware thread the scheduler can use; CPU(s) = sockets x cores per socket x threads per core. On cloud VMs a vCPU is usually one hyperthread, so 4 vCPUs are often 2 physical cores. In a container, lscpu and nproc show the host's CPUs; a CPU limit set with a cgroup quota is not visible here.
(none)Human-readable summary-eOne row per logical CPU: CPU, NODE, SOCKET, CORE, caches, ONLINE-pParsable CSV-style output for scripts-JJSON output-CCache details: size, ways, level, sharing-yShow physical IDs instead of logical onesnprocCompanion: number of CPUs this process may use (affinity)/proc/cpuinfoRaw per-CPU data that lscpu summarisesTreating '4 vCPU' as 4 physical coresOn most cloud instances a vCPU is one hyperthread; two vCPUs share one core's execution units.
Check Thread(s) per core and Core(s) per socket in lscpuSizing a container's thread pool with nproc or lscpu inside itA --cpus or Kubernetes CPU limit is a CFS quota, invisible to nproc and lscpu, which report the host's CPUs.
Read /sys/fs/cgroup/cpu.max, or set the pool size explicitlyUsing BogoMIPS to compare CPU speedBogoMIPS is a calibration loop for kernel delays, not a benchmark.
Compare model names and run a real benchmark of your workloadTry these on a Linux machine of your own. Each task has a hint and a solution.
Find how many logical CPUs, cores per socket and threads per core this machine has.
Show one row per logical CPU with its core and socket.
Compare nproc with the number of 'processor' entries in /proc/cpuinfo.