|
Actually, that's not going to give you the right number, because there is an entry in /proc/cpuinfo for each core. So if you have 2 4-core processors, even though there will be 8 entries in /proc/cpuinfo, each will report that their processor contains 4 cores, and you will get a result of 32 when in fact you only have 8 cores.
santysham's solution will actually give you the correct result, perhaps in a not very obvious way. You can abbreviate it to grep -c cores /proc/cpuinfo.
|