Home Linux Basics How To Check Or Find CPU Information In Linux

How To Check Or Find CPU Information In Linux

By sk
Published: Updated: 8.1K views

The Central Processing Unit, shortly CPU, is the most important component of a Computer. CPU is also called as microprocessor or simply processor. Just like how the brain controls a human body, the CPU controls all the parts of a Computer. Hence, CPU is considered as the brain of a Computer. You may know the basic details of your processor like Intel Core i3, i5, AMD etc. But what about the other details such as processor speed, number of cores, architecture, cache size and so on? In this guide, we will discuss all the possible ways to find CPU information in Linux using various command line tools as well as graphical tools.

Find CPU information in Linux

There are plenty of utilities (both CLI and GUI) available to get the CPU information in Linux. Let us look at them one by one.

All methods given below are tested in Ubuntu 20.04 LTS desktop system.

Method 1- Check CPU information using lscpu

The lscpu command line utility collects CPU architecture information from sysfs and architecture-specific libraries like /proc/cpuinfo. The lscpu command gathers the CPU details such as number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes. It will also retrieves information about the CPU caches and cache sharing, family, model, bogoMIPS, byte order, and stepping etc. The lscpu command is part of the util-linux package, so don't bother with installation.

To find CPU information in Linux using lscpu command, simply run it without any options:

$ lscpu 

Sample output:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   36 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              2
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           42
Model name:                      Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
Stepping:                        7
CPU MHz:                         838.397
CPU max MHz:                     2300.0000
CPU min MHz:                     800.0000
BogoMIPS:                        4589.90
Virtualization:                  VT-x
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        3 MiB
NUMA node0 CPU(s):               0-3
[...]
Check CPU information in Linux using lscpu command
Check CPU information in Linux using lscpu command

1.1. Display specific CPU information using lscpu in Linux

As you can see, lscpu displays complete information about your CPU. You can also narrow down the results using grep command to filter a specific detail, for example model name, like below:

$ lscpu | grep -i 'Model name'
Model name:                      Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz

If you want to display only the processor model, run:

$ lscpu | grep -i "Model name:" | cut -d':' -f2- -
                      Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz

Similarly, you can find other CPU details, for example number of CPU cores, like below:

$ lscpu | grep -i "CPU(s)"
CPU(s):                          4
On-line CPU(s) list:             0-3
NUMA node0 CPU(s):               0-3

1.2. Find Processor generation in Linux

Did you notice the numbers (i.e. 2350M) following the "i3-" part in the above output? The first 2 after i3 shows the processor generation. In this case, my processor is 2nd generation.

To learn more about Intel processor numbers, refer this link.

Method 2 - Find CPU information in Linux using /proc/cpuinfo file

As I mentioned in the previous section, lscpu gathers the processor details from /proc/cpuinfo file. So, we can simply display the contents of this file using cat command to check CPU details in Linux.

$ cat /proc/cpuinfo

Sample output:

Check CPU information in Linux using cpuinfo file
Check CPU information in Linux using cpuinfo file

Unlike the lscpu command, this will display information about each CPU core. So you will get output much longer than lscpu.

As we saw earlier, we can also filter specific CPU details from /proc/cpuinfo file using grep command. For instance, to display the processor family, run:

$ cat /proc/cpuinfo | grep "cpu family"

Method 3 - View processor information using lshw

Lshw (Hardware Lister) is a full-featured CLI utility that provides detailed information on the hardware configuration of a Linux system. It can get the hardware details such as exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed etc.

The lshw utility has both commandline and graphical interface. It comes pre-installed on most Linux distributions. If it is not installed for any reason, you can install lshw on your machine using the default package manager. For example, run the following command to install lshw on Debian, Ubuntu, Pop_OS!:

$ sudo apt install lshw lshw-gtk

To view processor information with lshw, simply run:

$ sudo lshw -class processor

Sample output:

$ sudo lshw -class processor
  *-cpu                     
       description: CPU
       product: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
       vendor: Intel Corp.
       physical id: 4
       bus info: cpu@0
       version: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
       serial: To Be Filled By O.E.M.
       slot: CPU 1
       size: 987MHz
       capacity: 2300MHz
       width: 64 bits
       clock: 100MHz
[...]

If you want to display only the processor model, use -short option with lshw command:

$ sudo lshw -short -class processor
H/W path         Device           Class          Description
============================================================
/0/4                              processor      Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
View processor information with lshw in Linux
View processor information with lshw in Linux

Lshw also has a graphical interface. Launch lshw gui from application menu or Terminal by running the following command:

$ sudo lshw-gtk

Double click on Portable Computer -> Motherboard -> CPU to get the complete details of your CPU.

View processor information with lshw gui
View processor information with lshw gui

Method 4 - Get processor details using dmidecode

The dmidecode utility fetches the details of a system's hardware components from DMI (Desktop Management Interface) table. It will first try to read the DMI table from sysfs, and next try reading directly from memory if sysfs access failed. After locating the DMI table, dmidecode will then parse this table and displays system's hardware information in a human-readable format. Dmidecode comes pre-installed in most Linux OSes, so let us not bother about installation.

To get the CPU details with dmidecode in Linux, run:

$ sudo dmidecode --type processor

Sample output:

Get CPU details with dmidecode in Linux
Get CPU details with dmidecode in Linux

Method 5 - View CPU info using inxi

Inxi is a command line system information tool to display system information such as CPU, drivers, xorg, desktop environment, Kernel, GCC version(s), processes, RAM usage, and a lot of other useful information.

Inxi is available in the default repositories of many Linux and Unix operating systems. For example ,on Deian, Ubuntu, Pop_OS!, we can install inxi using command:

$ sudo apt install inxi

To display Processor details using inxi, use -C or --cpu flag:

$ inxi -C

Or,

$ inxi --cpu

This will display complete CPU details including no of cores, CPU model, CPU cache, CPU clock speed, CPU min/max speed etc.

CPU:       Topology: Dual Core model: Intel Core i3-2350M bits: 64 type: MT MCP L2 cache: 3072 KiB 
           Speed: 821 MHz min/max: 800/2300 MHz Core speeds (MHz): 1: 798 2: 798 3: 798 4: 798

Method 6 - Print CPU information using hardinfo

HardInfo is a graphical utility to gather information about your system's hardware and operating system and generate printable reports either in HTML or in plain text formats.

Hardinfo is available in the default repositories, so install it using the distribution's default package manager. On Debian, Ubuntu, run the following command to install Hardinfo:

$ sudo apt install hardinfo

After installing hardinfo, launch it from dash or menu. Click on the Processor option under the Devices section on the left pane to get the CPU/processor details:

Get processor details with hardinfo in Linux
Get processor details with hardinfo in Linux

Method 7 - using hwinfo

Hwinfo is a yet another command line utility to find a system's hardware information. It probes for the hardware present in a Linux system and displays the extensive details of each hardware device.

It is not preinstalled by default. You can install hwinfo on Debian-based systems using command:

$ sudo apt install hwinfo

To view CPU info using hwinfo, run:

$ sudo hwinfo --cpu

Sample output:

View CPU info using hwinfo in Linux
View CPU info using hwinfo in Linux

If you want the short summary of CPU, run:

$ sudo hwinfo --short --cpu

Method 8 - using cpuid

Cpuid dumps detailed information about the CPU(s) gathered from the CPUID instruction, and also determines the exact model of CPU(s) from that information.

It is also not pre-installed by default, so install cpuid depending upon the distribution type you use as shown below.

On Debian, Ubuntu:

$ sudo apt install cpuid

On RPM-based systems like Fedora:

$ sudo dnf install cpuid

After installing cpuid, get your processor information using command:

$ cpuid

Sample output:

Find CPU details using cpuid command in Linux
Find CPU details using cpuid command in Linux

As you can see, Cpuid displays much more detailed information on your CPU, compared to other utilities.

Method 9 - using nproc

Nproc is part of GNU coreutils. It doesn't provide much information on CPU. It only prints the number of processing units available to the current process.

$ nproc 
4

The number of units might be less than the number of online processors. To print the number of installed processors, use --all flag:

$ nproc --all

You probably will get the same result in both cases.

Method 10 - using hwloc

The hwloc utility provides command line tools and a C API to obtain the hierarchical map of key computing elements, such as:

  • NUMA memory nodes,
  • shared caches,
  • processor packages,
  • processor cores,
  • and processor "threads".

Make sure you have installed hwloc on your system:

$ sudo apt install hwloc

To display your Linux CPU details, run:

$ hwloc-ls

This command will display your processor details in a simple map-like diagram as shown below.

Get processor info with hwloc
Get processor info with hwloc

Bonus - Find Intel processor architecture family in Linux

If you want to find what architecture the processors are using such as Haswell, Sandybridge, Ivybridge, run:

$ cat /sys/devices/cpu/caps/pmu_name 
sandybridge

As per the output, I have sandybridge chip. Please note that this fie doesn't available for machines with AMD processor. You can also find the processor model and go to https://ark.intel.com/ link and enter the model no (E.g. i3-2350M) to find out which architecture it belongs to.

These are a few methods to find CPU information in Linux. If you know any other methods to get the processor details in Linux, please let us know in the comment section below. I will check and update this accordingly.

Featured image by Michael Schwarzenberger from Pixabay.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More