How to obtain CPU information on Linux

If you’ve forgotten some information about your CPU, there’s no need to dig out the box or open the case to figure out the make, model, and other information about it. Information about your CPU is stored in Linux, at the operating system level. This means it’s perfectly accessible for normal users, we just have to know where to look.

In this guide, we’ll see how to obtain CPU information on Linux, from both command line and GUI. On a related note, check out our guide on how to check and monitor CPU utilization if you want to measure the performance of your CPU.

In this tutorial you will learn:

  • How to obtain CPU information from command line and GUI
Obtaining CPU information on Linux

Obtaining CPU information on Linux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software lscpu, hardinfo
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Obtain CPU information via command line

There are several command line utilities we can use to obtain CPU information on Linux. The following methods show the most useful tools, which are installed by default on almost any Linux distribution.

The /proc/cpuinfo virtual file contains a lot of information about the CPUs installed in our system. View it with the following command.

# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 61
model name      : Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
stepping        : 4
microcode       : 0xffffffff
cpu MHz         : 2294.689
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 20
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt flush_l1d arch_capabilities
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds
bogomips        : 4589.37
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

The only downside to this method is that it will output information for each logical processor, so the terminal can get a bit spammy – you could always pipe to more to clean it up.

Most CPUs these days have multiple cores, and the operating system will perceive each one as an individual processor. Therefore, the procinfo method could output the same information 16 times (assuming you have an 8 core CPU with multithreading).

Some helpful information from the /proc/cpuinfo virtual file is as follows:

  • CPU make and model: Intel(R) Core(TM) i5-5300U
  • CPU speed: 2.30GHz
  • Number of CPU cores: 2
  • Number of logical CPUs: 4
  • CPU cache size: 3072 KB
  • Enabled flags for the CPU – tells us what features the CPU is capable of

Another useful utility, which you may find a bit easier to use because of its concise output, is the lscpu command.

$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 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
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           61
Model name:                      Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
Stepping:                        4
CPU MHz:                         2294.689
BogoMIPS:                        4589.37
Hypervisor vendor:               KVM
Virtualization type:             full
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        3 MiB

This tells us a lot of the same information, but some of it’s easier to interpret. In particular, we get a nicer breakdown of CPU cores. Here’s how to interpret:

  • Sockets: 1 (this is the actual number of physical CPUs)
  • Cores per socket: 2 (therefore we have 2 cores total)
  • Threads per core: 2 (2 threads x 2 cores = 4 logical CPUs)

The lscpu command also gives us information about our hypervisor and various cache sizes.

There are even more command line utilities available, but they’re not installed by default on some distros, and all the information we need can usually be obtained from the two utilities covered above.

Obtain CPU information via GUI

If you’d prefer to use a GUI application to view CPU info, rather than fiddle with the command line, there’s a very handy program called “hardinfo” that can be installed on any major Linux distribution. Use the appropriate command below to install it with your system’s package manager.

To install hardinfo on Ubuntu, Debian, and Linux Mint:

$ sudo apt install hardinfo

To install hardinfo on CentOS, Fedora, AlmaLinux, and Red Hat:

$ sudo dnf install hardinfo

To install hardinfo on Arch Linux and Manjaro:

$ sudo pacman -S hardinfo

After it’s installed, you can either open it from your system’s app launcher, or just execute hardinfo in a terminal.

$ hardinfo

The application shows us information about all of our system’s hardware, but to see CPU info specifically, click on the processor tab in the left pane.

Click on the processor tab

Click on the processor tab

Highlight your CPU, and check the bottom pane for a lot of detailed information. In the screenshot below, we’ve expanded the information pane to better see the CPU’s specs.

The detailed CPU info is listed in the bottom pane

The detailed CPU info is listed in the bottom pane

Closing Thoughts

In this guide, we saw how to obtain information about our installed CPUs on a Linux system. This included two command line methods, as well as a GUI application. This should tell you enough about your system, without needing to check the manual or research your PC specs.

Comments and Discussions
Linux Forum