Re: Question on /proc/cpuinfo

From: Cong Wang
Date: Fri Sep 14 2012 - 08:30:14 EST

On 09/14/2012 07:18 AM, JA MagallÃn wrote:

Probably it is a stupid question, but... I wan to count the number of
processors, cores and threads on a linux system. I do it by reading


Since when is it safe to read things the modern way (kernel version ?).
Is there a better procedure to get this info ?

Probably lscpu(1) is better for you, on my laptop it outputs:

% lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 23
Stepping: 10
CPU MHz: 2401.000
BogoMIPS: 4788.03
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 3072K
NUMA node0 CPU(s): 0,1

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at