How to find the number of cores in a Red Hat Linux box?

Hi,

Could you please Tell me the command to find the number of cores in red hat box?

I have tried cat cat /proc/cpuinfo | grep processor | wc -l command to find the number of processers.

But need to fond the number of cores.

Is there any difference between core and processor?

Please help on this.

Regards,
Vikas.

Yes - a lot of difference.

Try this command

 egrep 'core id|physical id' /proc/cpuinfo | tr -d "\n" | sed s/physical/\\nphysical/g | grep -v '^$' | sort | uniq | wc -l
1 Like

Hi Jim,

Thanks for the help.

cat /proc/stat will show more specific info ... :slight_smile:

1 Like

I'd also like to point out that the techniques in the newer kernels that actually have the fairly good core reporting for x86 style CPUs still won't work well for really old dubious x86 processors with their stranger "core" handling. It's a small subset of processors... most desktop users will have never seen these.

And of course, core reporting outside of x86 is a mixed bag (what a core "is" varies for some of those as well).

1 Like