How to Get CPU Information in Linux?

Knowing the specifications of a CPU can help you determine how well it will perform certain tasks. If you’re experiencing any system issues, checking the CPU’s information can help you troubleshoot the problem.

In Linux, you can do anything on your system using the terminal, and getting all the information related to the CPU is one of them.

This guide explains all the methods to get all CPU information in Linux, and we’ll be using the following command-line utilities, most of which are pre-installed while some need to be installed.

Let’s start discussing different ways to get CPU information in Linux.

Get CPU Information Via Terminal

There are multiple commands you can do this job which is explained in the below section.

Using the Inxi Tool

Using the Inxi Tool, users can get all the CPU-related information, including the model, the total number of cores, clock speed, and much more. It isn’t pre-installed in any Linux distribution and can be installed using these according to your distro.

$ sudo yum install inxi	             #RHEL
$ sudo apt install inxi 	             #Debian
$ sudo dnf install inxi	             #Fedora 22+

To get the information on your CPU, use this command.

$ sudo inxi -C

The above image shows all the basic information you can view using the Inxi tool on Linux, and “-C” stands for CPU. Many more options can be used to view data. For example, we’d use “-G” instead of “-C” to get the information regarding GPU.

Using the Ishw Tool

The Ishw tool provides users with in-depth information about the computer hardware, including the CPU, and it comes pre-installed in all distributions of Linux. For displaying CPU-related information, the following command is used.

$ sudo lshw -C CPU

As you can see in the above image, the complete detail of the CPU is presented using the lshw command-line tool of Linux.

Using the cpuid Command

The cpuid command is used to get all information related to the CPU, including family, model, vendor ID, and much more. It isn’t pre-installed in Linux, so users must use either of the following commands to install it.

$ sudo yum install cpuid	    #RHEL
$ sudo apt install cpuid      #Debian
$ sudo dnf install cpuid	    #Fedora 22+

And now, to view the CPU information, we’d use this command.

$ cpuid

Using the lscpu Command

To know about the architecture of your CPU, there is nothing better than the lscpu command that can help you, and it is pre-installed with all Linux distros and can be used like this.

$ lscpu

The command mentioned above: lscpu, displays a complete architecture of the currently installed CPU, which is a detail, unlike other tools.

Using the cat Command

In Linux-based operating systems, a file contains a fair bit of information about your CPU and the best way to view it; the cat command should be used. The file “/proc/cpuinfo” can be viewed this way.

$ cat /proc/cpuinfo

The cat command doesn’t display anything on its own, but it is used to read the text file, and we’ve viewed the CPU information from a file using it.

Using the hwinfo Tool

The hwinfo tool of Linux is used to view the complete detail of specific computer hardware, which is the CPU in our case, and it displays the information of all Cores of your CPU. It isn’t pre-installed, so to use it, either of these commands should be used to install it, depending on your distro.

$ sudo yum install hwinfo                   #RHEL 
$ sudo apt install hwinfo                   #Debian
$ sudo dnf install hwinfo	                  #Fedora 22+

Users must use the following command to get CPU information using the “hwinfo” command.

$  hwinfo --cpu

The command mentioned above displays information about the CPU and can also be used to get information about other computer components. For example, to get all the information about the RAM, we’d replace “–cpu” with “–ram” and press enter.

Get CPU Information via GUI

You can also get the CPU information via GUI, which is explained below.

Using the Hardinfo Tool

Hardinfo is a Linux tool that can display the configuration of your system, including the CPU, on a GTK+ window. This tool is not installed in Linux by default. Hence, you have to install it by using any of the following commands depending on the distribution that you are using:

$ sudo yum install hardinfo	   #RHEL 
$ sudo apt install hardinfo 	   #Debian
$ sudo dnf install hardinfo	   #Fedora 22+ 

Once it is installed, users need to launch it by using this command.

$ hardinfo

And it will launch the tool’s GUI, which looks like this.

This tool lets users know every piece of hardware installed in their system.

Using System Settings

This usually varies for every distribution. Still, in Ubuntu, you can go to “Settings” and select the “About” tab to get all the required information, as shown below:

These were all the ways to get the CPU information in Linux.

Conclusion

Knowing what your CPU is capable of requires the knowledge of your CPU, which could be helpful for users working with heavy software that needs a good processor with more cores, etc. Going through this guide, you’ll see many valuable commands/tools to get CPU information in Linux.