[RH199] Command to get number of available CPUs

Latest response

https://role.rhu.redhat.com/rol-rhu/rhz/rhls/course/rh199-7/ch06s06

The proper way to get number of CPUs available is "getconf _NPROCESSORS_ONLN".

Responses

Eugene, you should examine this discussion https://access.redhat.com/discussions/480953 and the use of lscpu & also lshw (you might have to install lshw) and this solution https://access.redhat.com/solutions/61791 for the use of dmidecode and using grep from /proc/cpuinfo

Others in that first link I posted mentioned this https://access.redhat.com/site/solutions/61791 and this https://access.redhat.com/site/solutions/224883

EDITED/ADDED: recommend reading the comments at the "solution" links as well and evaluating it for yourself.

One of the things I like most about Linux (and opensource in general) is that there are often more than a single way to do something. "Proper" isn't necessarily accurate as there are usually several different ways to accomplish the same task. Is the most important thing that someone is able to answer the question "How many processors are there?" or is the most important thing how they arrived at the answer?

-STM

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.