Home Beginner's Guide How to Get Detailed CPU Information on Your Linux System

How to Get Detailed CPU Information on Your Linux System

Understanding your system's CPU is crucial for optimizing performance and troubleshooting issues. This guide walks you through various commands and tools to explore detailed CPU information on Linux, helping you analyze and manage your processor’s performance effectively.

by Arun Kumar
find cpu info in linux

As a Linux administrator, one of my favorite things is diving into the nitty-gritty details of system information. Today, I’ll take you on a ride to explore how to retrieve and understand CPU information on a Linux system. We’ll be using Ubuntu for our examples, but I’ll also also provide commands relevant to other popular distributions.

Why knowing your CPU info is important

Knowing your CPU information can help in various situations, such as optimizing performance, troubleshooting issues, and ensuring compatibility with software. Regardless of whether you’re a system administrator, a developer, or just a curious user, understanding your CPU can be incredibly valuable.

Using /proc/cpuinfo

The /proc/cpuinfo file contains detailed information about the CPU(s) on your system. It’s a virtual file, meaning it doesn’t physically exist on your disk but is created dynamically by the kernel.

How to read /proc/cpuinfo

To view the contents of /proc/cpuinfo, simply use the cat command in your terminal:

cat /proc/cpuinfo

Here’s a sample output snippet from my Ubuntu machine:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 158
model name  : Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
stepping    : 10
microcode   : 0xca
cpu MHz     : 800.000
cache size  : 9216 KB
physical id : 0
siblings    : 12
core id     : 0
cpu cores   : 6
apicid      : 0
initial apicid : 0
fpu         : yes
fpu_exception : yes
cpuid level : 22
wp          : yes
...

Breaking down the output

  • processor: The processor number. If you have a multi-core CPU, you’ll see multiple entries (0, 1, 2, …).
  • vendor_id: The manufacturer of the CPU (e.g., GenuineIntel, AuthenticAMD).
  • model name: The official name of the CPU.
  • cpu MHz: The current clock speed of the CPU in MHz.
  • cache size: The size of the L2 cache in KB.
  • cpu cores: The number of cores per physical CPU.
  • siblings: The number of logical processors per physical CPU. This includes hyper-threaded cores.

Using lscpu

The lscpu command provides an easy-to-read summary of CPU architecture information.

How to use lscpu

Simply type lscpu in your terminal:

lscpu

Here’s an example output:

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):                 12
On-line CPU(s) list:    0-11
Thread(s) per core:     2
Core(s) per socket:     6
Socket(s):              1
NUMA node(s):           1
Vendor ID:              GenuineIntel
CPU family:             6
Model:                  158
Model name:             Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Stepping:               10
CPU MHz:                900.000
CPU max MHz:            4100.0000
CPU min MHz:            800.0000
BogoMIPS:               4399.93
Virtualization:         VT-x
L1d cache:              192 KiB
L1i cache:              192 KiB
L2 cache:               1.5 MiB
L3 cache:               9 MiB
NUMA node0 CPU(s):      0-11
Flags:                  fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperf ...

Key details in lscpu output

  • Architecture: The CPU architecture (e.g., x86_64).
  • CPU(s): Total number of CPUs (logical processors).
  • Thread(s) per core: Number of threads per core (often 2 for hyper-threaded cores).
  • Core(s) per socket: Number of cores per socket.
  • Socket(s): Number of physical CPU sockets.
  • CPU max MHz / min MHz: The maximum and minimum CPU frequencies.
  • L1d, L1i, L2, L3 cache: Cache sizes for different levels.

Using lshw

The lshw (list hardware) command provides detailed information about all hardware components, including the CPU.

How to use lshw for CPU info

To get CPU information, you can filter the lshw output:

sudo lshw -class processor

Here’s a sample output:

  *-cpu                   
       description: CPU
       product: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
       vendor: Intel Corp.
       physical id: 3
       bus info: cpu@0
       version: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
       slot: U3E1
       size: 2200MHz
       capacity: 4100MHz
       width: 64 bits
       clock: 100MHz
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperf...
       configuration: cores=6 enabledcores=6 threads=12

Key details in lshw output

  • description: Description of the CPU.
  • product: The CPU model.
  • vendor: The manufacturer.
  • size: Current operating frequency.
  • capacity: Maximum frequency.
  • width: Bit width (e.g., 64 bits).
  • configuration: Number of cores and threads.

Distribution-specific steps

While the above commands are mostly universal, there might be slight variations or additional tools available on different distributions.

For Debian-based distros (like Ubuntu)

The commands and tools mentioned above are directly applicable. Make sure you have the lshw package installed:

sudo apt-get install lshw

For Red Hat-based distros (like CentOS, Fedora)

You might need to install lshw using yum or dnf:

sudo yum install lshw   # for CentOS
sudo dnf install lshw   # for Fedora

For Arch-based distros

You can install lshw using pacman:

sudo pacman -S lshw

Conclusion

Exploring your CPU information on Linux is not only a great way to learn more about your hardware but also crucial for system optimization and troubleshooting. Personally, I find it fascinating to see the intricate details of my CPU and understand how it powers my day-to-day tasks.

Feel free to explore these commands and delve into your own CPU’s details. You might discover something new and interesting about your system!

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.