Last updated on November 18th, 2022 at 10:44 am
Quick guide on counting the number of processors in Linux server
Using cpuinfo file
Simple command to find the number of processor in linux.
Run
cat /proc/cpuinfo | grep processor|wc -l
Try to run the command as root, it might throw you a permission denied if you run as a normal user. This command will give you the total number of processor installed on the server.
Using lscpu Command
lscpu displays the information about CPU architecture. It gathers information from sysfs,/proc/cpuinfo file and other libraries and output the details in human readable format, output truncated
$ sudo lscpu
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Vendor ID: ARM
Model name: Neoverse-N1
Model: 1
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Stepping: r3p1
BogoMIPS: 243.75
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asim
ddp ssbs