Processors, cores & threads on this computer (Bash)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

How many processors, cores or threads does a given computer have? And which of these entities do I actually need?

Use case

I want to parallelise Bash commands and I want to know how many parallel threads I can have. I have the impression that I am actually looking for processors or processing units.

The answers...

  • First of all: It's indeed processing units that I'm looking for. Not something like threads or whatever
  • Secondly: All tools below give the same answers.
Computer External documentation nproc lscpu /proc/cpuinfo
bal1 -- 6
  • CPUs: 6
  • Threads/core: 1
  • Cores/socket: 6
  • Sockets: 1
bal5 TransIP: 2 cores 2
  • Sockets: 1
  • Cores/socket: 2
  • Thread/core: 1
  • CPUs: 2
dell2020 -- 8
  • CPUs: 8
  • Threads/core: 2
  • Cores/socket: 4
  • Sockets: 1
dvb8 TransIP: 8 cores 8
  • CPUs: 8
  • threads/core: 2
  • Cores/socket: 4
  • Sockets: 1


  • Use getconf -a to get all information - Some screens full
  • Use getconf -v specification for a specific aspect. E.g.: getconf -v NZERO.

What seems to get closed to what I'm looking for (output getconf -a) For my laptop (Dell2020 - Nov. 2022):

_NPROCESSORS_CONF                  8
_NPROCESSORS_ONLN                  8

But I can't get this to work with


Maybe find a better way.


nproc geeft het aantal processors weer, niet het aantal threads:Processors, cores & threads on this computer (Bash)

$ nproc


$ lscpu

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                6
On-line CPU(s) list:   0-5
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             6
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 85
Model name:            Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz
Stepping:              4
CPU MHz:               2494.096
BogoMIPS:              4988.19
Virtualization:        VT-x
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0-5
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 pku ospke md_clear

In dit geval 6.


Dit komt in de buurt:

echo "#CPUs: $(grep -c processor /proc/cpuinfo)"

Dit ook:

grep processor /proc/cpuinfo | wc -l