How to check processor details in linux


NetMarketShare reports that 1.84 percent out of all the PCs connected to the internet were running Linux, and Chrome OS, which is a Linux variant, has about 0.29 percent. These might seem like small numbers, but when you consider that over 250 million PCs are sold every year, the number of PCs running Linux that is connected to the internet go up to more than a million. If you happen to be one of them or if you have a friend or acquaintance who has a Linux PC and needs help with learning about processor or CPU details.



Look no further. The different commands that you need to use in order to learn details about the processor like the number of cores, availability of hyper threading, architecture, cache size etc. are many, and these include Iscpu, /proc/cpuinfo and Istopo (hwloc). They give detailed information about cpu cores/processing units. The examples that are given below explain how to go about interpreting the data that is obtained.


Vendor and model of processor

Search the /proc/cpuinfo file with the grep command.
$ cat /proc/cpuinfo | grep vendor | uniq
vendor_id : GenuineIntel
Once you learn the name of the processor, you can use the model name to look up the exact specifications online on Intel's website.
$ cat /proc/cpuinfo | grep 'model name' | uniq
model name : Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz


Architecture

The Iscpu command can be used to learn more about the architecture
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
.....
This proves that the architecture is x86_64 which is 64 bit.

Frequency

The frequency/speed of the processor is reported by both Iscpu and /proc/cpuinfo
$ lscpu | grep -i mhz
CPU MHz: 1998.000
$ cat /proc/cpuinfo | grep -i mhz | uniq
cpu MHz : 1998.000



The number of cores

If you have multiple cores in your CPU, your processor speed will also be much faster.
The Iscpu command will indicate the "cores per socket"
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
But counting only the number of processors would give you wrong numbers because, in hyperthreaded processors, the number of processors that the operating system sees is twice the number of cores. However /proc/cpuinfo has a field that is named ‘core id' which is a unique id for each core in a single processor. To know the actual number of cores on the processor, you can count the core id.
$ cat /proc/cpuinfo | grep -i 'core id'
core id : 0
core id : 2
core id : 1
core id : 3



Hyper threading

Hyper threading allows individual cores to behave like 2 logical processing units. This will increase the processing power of each core. You will need to compare two different values to learn if a processor has threading or not.
If the number of processing units is equal to the number of cores, that means there is no hyper threading. If the number of processing units is more than the number of cores, then there is hyperthreading.
Previous Post Next Post