Home » Linux » Shell » Get Cpu Information Linux

How to Get CPU Information on Linux

Within your computer, the central processing unit, aka the CPU, is a critical component. Despite its essential nature in performing countless data processing functions, many of us likely know very little about the CPU, hidden away inside the computer out of sight as it works its magic. Thankfully, finding CPU information on Linux systems is fairly straightforward, so let’s take a look at how it’s done.

Why You Might Need CPU Information

There are a few reasons why someone may want to obtain further CPU details. Perhaps you’re just curious about what goes on inside your computer and want to learn more. Maybe you need to debug a hardware issue, see how many concurrent processes are manageable, or handle software from its source. Perhaps you’re looking to sell or upgrade hardware, or maybe you’re planning on utilizing a kernel module. Whatever the reason, the command line should have the answers.

Using Commands

There are various commands that can bring up CPU information, depending on what you’re looking for. While there are various features accessible within the Linux system, like iscpu, some tools come as extras that can be downloaded for use, such as inxi and cpuid.

In essence, the /proc/cpuinfo holds most key information you’ll want, from vendor_ID and number of CPU cores to CPU architecture and speed. The commands help to bring out this information.

The following commands will show the CPU information in Linux:

Less or Cat Command

The cat command can be entered as follows:

cat /proc/cpuinfo

The less command can also be used.

less /proc/cpuinfo

This will report each CPU with the cores listed to identify each. The flags refer to the CPU features.

A grep command can be used to narrow down results to output just the aspects like the number of cores, model name, and so on. For example, to search by processor name, it would look like this:

grep -m 1 'model name' /proc/cpu info

cpuid Command

You’ll need to install this one and run cpuid, but it will generate full information on the x86 CPUs and their exact models. Enter the prompt :

cpuid

Inxi Command For System Details

System information can be gathered by Inxi, a command-line script for use with Internet relay chat and console. This needs to be installed first. The -c flag will dump full CPU information, so this is helpful if you want CPU clock-speed details:

inxi -C

dmidecode Command For Hardware

If you want hardware information, the dmidecode is a useful tool. This will generate the DMI table contents and the SMBIOS spec will show all the DMI forms (https://www.tecmint.com/check-linux-cpu-information/). As an example, the command may look like this :

sudo dmidecode —type processor

Nproc For CPU Number

The nproc command is a quick way to get a response to the question of how many CPUs there are:

nproc

Iscpu Command for CPU Architecture

This command-line utility will display details on the CPU architecture, except a list of logical CPUs, and it’s part of the util-linux package so it’s available on all Linux systems. Enter the following at the shell prompt:

lscpu

Top/Htop Command For Cores

The top or htop commands will detail the number of cores. Enter the following then press 1 :

top

Or

htop

Hardinfo For Hardware Details in GTK+

This tool can be installed to dump hardware information within a GTK+ window. The command can be entered as:

hardinfo

The user-friendly window will display and a report run by clicking “generate report”. A further window will open in which you can choose the information you desire in the report, such as from computer, devices, benchmark, and/or network. Click “generate” once the relevant areas are ticked, the report will be generated in HTML, so you can view this conveniently within your web browser.

Summary

Users have a variety of ways with which to extract information from the Linux system, and choosing one is a case of deciding what details you need to see, what format you’d like them in, and whether you wish to use a pre-installed function or download a tool with further capabilities.

SHARE:
Photo of author
Author
My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

Leave a Comment