[Linux] Commands to check CPU core count

Tadashi Shigeoka ·  Mon, February 26, 2018

I’ll introduce commands to check CPU core count on Linux.

Linux

Quickly check just CPU core count

$ nproc
4
$ getconf _NPROCESSORS_ONLN
4
$ cat /proc/cpuinfo | grep -c "processor"
4

Check CPU core count and processor count in detail

Check processor count

$ cat /proc/cpuinfo | grep processor
processor  : 0
processor  : 1
processor  : 2
processor  : 3

Check physical CPU count

$ cat /proc/cpuinfo | grep "physical id"
physical id  : 0
physical id  : 1
physical id  : 2
physical id  : 3

CPU core count for each physical CPU

$ cat /proc/cpuinfo | grep "cpu cores"
cpu cores  : 1
cpu cores  : 1
cpu cores  : 1
cpu cores  : 1

That’s all from the Gemba where I wanted to check CPU core count.

References