[TriLUG] Dual core question

Scott G. Hall ScottGHall at BellSouth.Net
Mon May 23 15:00:50 EDT 2005


Lee Fickenscher wrote:
> I don't have any dual core boxes, but on linux couldn't you do something
> like:
> 
> cat /proc/cpuinfo | grep -c processor
> 
> to get a core count? -Lee
> 
> Charles Fischer wrote:
>> I would like to get a CPU core count from a Linux box.

You need to modify that:

cat /proc/cpuinfo | cut -f1 -d: | grep -c processor

The reason is that my machine is a single processor, and here is the output:

$ cat /proc/cpuinfo | grep -c processor
2

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 7
model name      : AMD Duron(tm) processor
stepping        : 1
cpu MHz         : 1300.040
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
bogomips        : 2595.22

$ cat /proc/cpuinfo | cut -f1 -d: | grep -c processor
1

--
Scott G. Hall
Raleigh, NC, USA
ScottGHall at BellSouth.Net



More information about the TriLUG mailing list