How To EASILY View CPU Info In Linux Over CLI

0
44
How To EASILY View CPU Info In Linux Over CLI

Have you ever wondered what’s under the hood of your computer’s central processing unit (CPU)? Well, wonder no more! Linux command line interface (CLI) offers a powerful and efficient way to access and display CPU information. From the clock speed and number of cores to the cache size and instruction set, the CLI provides a wealth of technical details that can help you understand how your CPU works and how to optimize its performance. So, get ready to unleash your inner geek and join me on this exciting journey of exploring CPU info in Linux through the CLI..elementor-widget-spacer,.e-con>.elementor-widget-spacer{width:var(–container-widget-width,var(–spacer-size));–align-self:var(–container-widget-align-self,initial);–flex-shrink:0;}.e-con-inner>.elementor-widget-spacer>.elementor-widget-container,.e-con>.elementor-widget-spacer>.elementor-widget-container{height:100%;width:100%;}.e-con-inner>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer,.e-con>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer{height:100%;}.e-con-inner>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer>.elementor-spacer-inner,.e-con>.elementor-widget-spacer>.elementor-widget-container>.elementor-spacer>.elementor-spacer-inner{height:var(–container-widget-height,var(–spacer-size));}.e-con-inner>.elementor-widget-spacer.elementor-widget-empty,.e-con>.elementor-widget-spacer.elementor-widget-empty{position:relative;min-height:22px;min-width:22px;}.e-con-inner>.elementor-widget-spacer.elementor-widget-empty .elementor-widget-empty-icon,.e-con>.elementor-widget-spacer.elementor-widget-empty .elementor-widget-empty-icon{position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;padding:0;width:22px;height:22px;}/*]]]]>*/]]>Now, when it comes to an overview of CPU info, there are several handy ways to do this.The top command is a powerful tool for monitoring system activity in real-time, including CPU usage. When you run the top command in the terminal, you’ll see a live display of system statistics, including the percentage of CPU usage by each running process. This is what it looks like and, here is a post to further learn about the top command as well as it’s close cousins, htop and btop.

What about cores? Like always, in Linux there is more than one way to achieve the same results. I’ll throw 2 solutions at you for this one.
One handy trick that has existed in Linux since the dinosaurs, is cat! Well, technically cpuinfo but let’s still give cat some credit, ok?

linuxman@ubuntu:~$ cat /proc/cpuinfo | grep cores
cpu cores : 1

Normally, there is much more info about the CPU using this method but we’re only interested in our CPU core count for now. So, we are filtering the output of cpuinfo using grep to search for a line that includes “cores”. And as we can see, in my little guinea pig VM, it only has one core.For the other handy trick, we will use lscpu but filter out a lot of other junk we’re not interested in right now.

linuxman@ubuntu:~$ lscpu | grep “CPU(s)” | head -n 1
CPU(s): 1

Why is this command so long? I don’t know, but it works for me (insert shrug emoji). lscpu actually has way more info than cpuinfo and much more simplified. But because it is dumbed down, we have to do a bit more filtering to get only what we want out of it.As you can see, I filtered “CPU(s)” because unlike cpuinfo, “cores” gives us something completely different. What can you do about it?I follow up with head to filter the first line of output because there are multiple lines that include “CPU(s)”. Anyhow, we still get decent results!As far as hardware info, yes, you can use the last two commands but where’s the fun in that? cpuinfo is too mainstream, am I right?
First up, we have dmidecode. This one is like asking your CPU for its ID card. It displays hardware information about the CPU, including the manufacturer, model name, family, and more. It’s like getting to know your CPU on a personal level, finding out its name, where it’s from, and what it likes to do. So, if you really want to dig deep into your machine’s guts, dmidecode it!

linuxman@ubuntu:~$ sudo dmidecode -t processor
[sudo] password for linuxman:
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.

Handle 0x0400, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU 0
Type: Central Processor
Family: Other
Manufacturer: QEMU
ID: 10 0F 83 00 FF FB 8B 07
Version: pc-q35-6.1
Voltage: Unknown
External Clock: Unknown
Max Speed: 2000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: Not Provided
L2 Cache Handle: Not Provided
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 1
Core Enabled: 1
Thread Count: 1
Characteristics: None

Next up, we have lshw. This command is like opening up your CPU and looking inside. It lists detailed information about the CPU hardware, including the CPU type, clock speed, cache size, and more. It’s like being a surgeon, exploring the inner workings of your CPU to better understand how it operates.

linuxman@ubuntu:~$ sudo lshw -C cpu
*-cpu
description: CPU
product: AMD EPYC-Rome Processor
vendor: Advanced Micro Devices [AMD]
physical id: 400
bus info: cpu@0
version: pc-q35-6.1
slot: CPU 0
size: 2GHz
capacity: 2GHz
width: 64 bits
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp x86-64 rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibpb stibp vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr wbnoinvd arat umip rdpid arch_capabilities
configuration: cores=1 enabledcores=1 threads=1

If you’re curious about your CPU temperature and want to check it in Linux CLI, you can use the sensors command. Think of it as your very own personal weatherman for your system – it reads the data from the sensors on your motherboard and reports back the temperature readings, including those for the CPU.Keep in mind that depending on your system’s configuration, you may need to run the sensors-detect command first to detect and load the appropriate kernel modules for your system’s sensors. It’s like finding the right trail to hike on – you want to make sure you’re heading in the right direction.

linuxman@ubuntu:~$ sudo sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +47.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +46.0°C (high = +100.0°C, crit = +100.0°C)

acpitz-virtual-0
Adapter: Virtual device
temp1: +27.8°C (crit = +119.0°C)

amdgpu-pci-0200
Adapter: PCI adapter
vddgfx: 800.00 mV
fan1: 0 RPM
temp1: +47.0°C (crit = +94.0°C, hyst = -273.1°C)

nvme-pci-0100
Adapter: PCI adapter
Composite: +49.9°C (low = -273.1°C, high = +80.8°C)
(crit = +88.8°C)

And just like with the weather report, the temperature readings you get from the sensors command may not always be 100% accurate or consistent. So use the information as a general guideline rather than a definitive measurement. But overall, using the sensors command can be a fun and useful way to keep tabs on your system’s CPU temperature.
In conclusion, Linux CLI provides a treasure trove of information about your CPU hardware, and there are various ways to access this information. From the cat /proc/cpuinfo command that’s like being a detective on a case, to the dmidecode -t processor command that’s like getting to know your CPU on a personal level, each command offers a unique perspective on your CPU hardware. And if you prefer a more visual approach, there are GUI tools and third-party system information tools that can provide detailed CPU hardware information. Whether you’re a tech enthusiast, a system administrator, or just curious about your system, exploring CPU hardware information in Linux CLI can be an exciting and rewarding experience. So go ahead and start exploring – you never know what interesting CPU facts you might uncover!

LEAVE A REPLY

Please enter your comment!
Please enter your name here