23.2 C
Texas

Identify Number of Processors on a Linux Box

Linux box is a computer that is running with the power of a Linux operating system. As a part of the machine, the processor is a very important part as it enables performing all the tasks possible. In fact, the processor is one of the major components of a computer that you need to keep your eye on.

Today’s modern processors come up with multiple cores and hyper-threading that allows the processor to perform parallel tasks simultaneously. The more cores, the better performance at heavy load works. Check out the comparison between Intel and AMD processors.

Willing to find out how many cores are present in your system? Let’s find out!

Finding out processor core number

The simplest method for figuring out your processor number is by using a tool “nproc”. It’s a part of the Linux coreutils. Run the following command –

- Advertisement -
nproc --all

There’s another way to obtain the same result. This one will also allow you some additional information on your processor.

lscpu | grep 'CPU(s)'

You can also examine the “cpuinfo” file from “/proc” filesystem.

grep processor /proc/cpuinfo | wc -l

There are also a number of other information on the processor in the “cpuinfo” file.

cat /proc/cpuinfo | grep "model name"
cat /proc/cpuinfo | grep "cpu cores"

In the present world of hyper-threading, the number of actual cores (physical cores) and threads (logical cores) can also be separated.

# Get number of physical core(s)
lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l

# Get number of logical core(s)
lscpu -p | egrep -v '^#' | wc -l

If your Linux system doesn’t have the above tools, you can also use this following command for getting the same result –

getconf _NPROCESSORS_ONLN

With root privilege, you can directly get processor information using “dmidecode”.

dmidecode -t 4 | egrep 'Socket Designation|Count'

If you’re interested in getting a full, system-wide specification, you should use other tools like Superfetch or Neofetch.

Enjoy!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article