Linux display CPU information – number of CPUs and their speed

by nixcraft · 4 comments

Q. How do I display CPU information such as the number of CPUs and their speed?

A. Proc (/proc) file system provides easy information about CPU and their speed.
The proc filesystem is a pseudo-filesystem which is used as an interface to kernel data structures. It is commonly mounted at /proc. Most of it is read-only, but some files allow kernel variables to be changed.

Display the number of processors in Linux

You need to use /proc/cpuinfo file. This is a collection of CPU and system architecture dependent items, for each supported architecture a different list. Two common entries are processor which gives CPU number and bogomips; a system constant that is calculated during kernel initialization. SMP machines have information for each CPU. Type the following command:

$ less /proc/cpuinfo

Output:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz         : 2992.991
cache size      : 2048 KB
physical id     : 0
siblings        : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2
ss ht tm pbe nx lm pni monitor ds_cpl cid
bogomips        : 5931.00

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz         : 2992.991
cache size      : 2048 KB
physical id     : 0
siblings        : 2
.....
...
....

You can narrow down output with the following command, to display number of processors in the system:
$ grep processor /proc/cpuinfo

See also:

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 4 comments… read them below or add one }

1 wessy 05.27.09 at 9:25 am

thanks, works

2 user 07.01.09 at 6:19 am

this works, but you have to pay attention, cause not every time it shows correct info. For example i have 2x intel xeon quad core. cpuinfo shows 16 processors???!!

3 Blake Acheson 07.31.09 at 5:34 pm

you have 16 virtual processors total…that is correct

2 quads but each of the these physical processors implement hyperthreading

2 x (4×2)=16

4 Dave 02.10.10 at 2:36 pm

Many thanks!

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All