The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: awk question..
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 07-17-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
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.