Saturday, May 22, 2010

How to count the number of cores in a Linux machine

Use the following command:

cat /proc/cpuinfo | grep processor | wc –l

It is convenient to put it in a script which I will call, for example, ncores:

#!/bin/sh
cat /proc/cpuinfo | grep processor | wc –l

See enclosed screen shot:

ncores

No comments: