How To Get CPU Information.
The CPU (central processing unit), often called simply processor, is one of the essential components of your computer. It performs all types of data processing operations, and it often referred to as the computer’s brain.
Have you ever wondered what type of CPU you have in your system and what is the CPU speed? There are various reasons why you might need to know what CPU you have inside your machine. Perhaps you’re loading a kernel module or debugging a hardware related issue. Whatever the reason, on Linux, it’s quite easy to determine the processor type and speed from the command line.
Get CPU Info in Linux
The simplest way to determine what type of CPU you have is by displaying the contents of the /proc/cpuinfo virtual file.
Identifying the type of processor using the proc/cpuinfo file does not require installing any additional programs. It will work no matter what Linux distribution you are using.
Open your terminal and use less or cat to display the contents of /proc/cpuinfo:
The command will print each logical CPU with an identifying number. For example, if you have 8 core processor you will see a list of all cores starting from 0 to 7. Below is an example of the output:
Below is an explanation of the most interesting lines:
processor – A unique identifying number of each processor, starting from 0.
model name – The full name of the processor, including the processor brand. Once you know the exact type of CPU you are having, you can check the product documentation about your processor’s specifications.
flags – CPU features.
If you want to filter the output you can use the grep command . For example, to display only the processor name you would use:
To print the number of CPUs:
Knowing the number of CPUs can be handy when you need to compile software from the source, and you want to know how many parallel processes can be concurrently executed. Another way to find the number of CPUs is by using the nproc command:
Check CPU Info with lscpu
lscpu is a command-line utility that displays information about the CPU architecture. lscpu is a part of the util-linux package which is installed on all Linux distributions.
At a shell prompt, type lscpu:
The output will look something like below, including information about the number of CPUs, architecture, vendor, family, model, speed, caches, flags, etc.
Unlike the content of the /proc/cpuinfo file, the output of the lscpu doesn’t show a list of all logical CPUs.
In this guide, we have shown you how to find information about your system CPU. There are also other tools that you can use to determine your CPU name and vendor such as dmidecode, hardinfo and lshw, but most of them are not installed by default on Linux systems.