How To Get CPU (Central Processing Unit) Info and Number of CPU’s In Linux?
CPU is central part of the computer systems. They provide all logic and computation power to the operating system that runs on them. In general we look the frequency and brand of the CPU like i5,i7. There are very different features in detail in CPU’s. There are different commands to get CPU’s information like flags, instruction, product name etc. But most compatible CPU information source is /proc/cpuinfo
Getting Information From /proc/cpuinfo
$ more /proc/cpuinfo
- From vendor_id we can understand that this CPU is Intel
- model name is inside model name of Intel for this CPU
- cpu MHz specifies frequency or speed of this CPU
- we can see from flags those instruction sets supported by this CPU
- processor line specifies CPU index. In this case we have only one core which index is 0
- cache_alignment shows the architecture of CPU like 32 or 64 bit.
Getting Cpu Information With lscpu
Alternative to cpuinfo is lscpu which proved more understandable information about CPU like below. We do not provide any option for the current usage.
Following information about the CPU is provided with
Architecturedisplays the 32 or 64 bit of the CPU
CPU op-modedisplay which architectures the CPU can handle
Byte Orderis the byte order of the CPU instructions
CPUis CPU cunt
Threads Per Coreis how many threads are supported per core
Cores per Socketis how many cores are per socket
Model nameshows CPU model number in detail
CPU MHzshows the speed or frequency of the CPU
Virtualization typeshows which type of virtualization is supported
L1,L2,L3 cacheshows CPU cache size
Flagshow the instruction set supported by CPU.