Monday 19 September 2011

Display Number of Processors on Linux


If you’ve just upgraded your Linux box, or you are wondering how many processors a remote server has, there’s a quick and dirty command you can use to display the number of processors.
On Linux, /proc/cpuinfo contains all of the processor information for all current processors in your computer. This will include the speed, the amount of on-chip cache, processor type, and how many cores.
Here’s the command:
cat /proc/cpuinfo | grep processor | wc -l
The command just looks in the /proc/cpuinfo file, pulls out the number of lines containing the word “processor” and passes them into wc (word count), which returns a count of the CPUs in the system.
Here’s what it returned on my remote server:
[root@root]# cat /proc/cpuinfo | grep processor | wc -l
4
Note that if you have a dual-core processor, it will return each core as a separate processor. You can look at the full output of cat /proc/cpuinfo to see if the chips are dual-core.

No comments:

Post a Comment

Do not post irrelevant comments, please!

Browser Name:
Browser Version:
Browser Code Name:
User-Agent: