How to View CPU Speed on Linux | Baeldung on Linux (2024)

1. Introduction

The Central Processing Unit (CPU) is the main hardware unit on a computer that is responsible for executing instructions from programs. Because of that, the speed of the CPU has a significant impact on the system’s performance.

In this article, we will learn how to get both the base and real-time CPU speed information on Linux. There are various command-line utilities and scripts we can use to get the speed of our CPU.

2. CPU Speed

CPU speed is defined as clock speed or clock rate. The clock rate indicates the processing frequency of a processor. In other words, it determines how many instructions a CPU can interpret per second. Since modern processors are very fast, the clock speed is usually defined as MHz or GHz.

In general, a CPU has a base speed which can be seen from the hardware specifications. However, in practice, the clock rate is most often higher than this rate, and it might vary from time to time.

3. Inspecting /proc/cpuinfoFile

The first method we can use to find CPU speed is reading the virtual file /proc/cpuinfo. In this file, there is a lot of information regarding the CPU. Since we are looking only for the clock speed, we can directly filter the information we need:

$ cat /proc/cpuinfo | grep Hzmodel name: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzcpu MHz: 2904.004model name: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzcpu MHz: 2904.004

As we mentioned previously, there are base and real-time clock speeds. In this case, these values are 2.70 GHz and 2904.004 MHz, respectively.

Furthermore, the reason there are two outputs is that this file displays CPU information for each processor core. So, it means that there are two cores in this particular system that gives the above output. In this example, the clock rates are the same for both cores.

If we want to monitor the speed for some period of time, we can use the watch command:

$ watch -n1 "grep Hz /proc/cpuinfo"Every 1.0s: grep Hz /proc/cpuinfo baeldung: Sun Jun 26 16:21:32 2022model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzcpu MHz : 2904.004model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzcpu MHz : 2904.004

The above output will refresh every second. We can change the period by modifying the value after the -n option.

4. Using lscpu

We can also use thelscpu command-line utility to retrieve the CPU speed. lscpu collects the general CPU architecture information from the /proc/cpuinfo virtual file and the sysfspseudo-file system.

Again, since we are not interested in all of the information about the CPU, we filter the output so that we get the speed information we’re looking for:

$ lscpu | grep CPUCPU op-mode(s): 32-bit, 64-bitCPU(s): 2On-line CPU(s) list: 0,1CPU family: 6Model name: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzCPU MHz: 2904.000NUMA node0 CPU(s): 0,1Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state unknownVulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT Host state unknown

As we can see from the output of lscpu, the results are 2.70 GHz and 2904.004 MHz, just like before.

5. Looking at the Kernel Message Buffer With dmesg

dmesg is a command that prints message buffers generated by the kernel and device drivers. Similarly to previous methods, we can get the CPU speed information by filtering out the output of dmesg:

$ dmesg | grep Hz[ 0.000016] tsc: Detected 2904.004 MHz processor[ 0.238892] smpboot: CPU0: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (family: 0x6, model: 0x8e, stepping: 0x9)...

Here, we got the 2904.004 MHz clock rate, and we saw the CPU with a 2.70 GHz base frequency, like with the previous methods. Note that there may be some irrelevant outputs for the above command.

6. Parsing the SMBIOS Data With dmidecode

dmidecode is a tool that parses the System Management BIOS (SMBIOS) data in a human-readable format. SMBIOS provides data structures to get access to the information about the hardware components of a system, such as memory devices or processors, as well as the BIOS management.

$ sudo dmidecode -t processor | grep Hz Version: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHzExternal Clock: 100 MHzMax Speed: 2900 MHzCurrent Speed: 2600 MHz

This time, the output is slightly different from others. Besides, we may want to keep in mind that dmidecode could sometimes give unreliable results because it extracts the data from SMBIOS tables instead of probing the actual hardware.

7. Utilizing the inxiScript

Another way to get CPU speed information is to use theinxiscript.inxi can provide a variety of useful pieces of information from drivers to the kernel, but we are only interested in the CPU information. In order to use inxi, we need to install it with our package manager.

Let’s take a look at what types of information the script returns about the CPU:

$ sudo inxi -cCPU: Dual Core Intel Core i7-7500U (-MCP-) speed: 2904 MHz Kernel: 5.13.0-51-generic x86_64 Up: 22m Mem: 465.6/971.2 MiB (47.9%) Storage: 20.00 GiB (50.7% used) Procs: 201 Shell: bash 5.0.17 inxi: 3.0.38

Above, we used -c to retrieve data about the CPU. Correspondingly, we observe that the CPU speed is 2904 MHz.

hwinfo logs some useful information about general hardware in the system. We can install this manually too, by simply using our package manager.

After that, in a similar fashion to the other methods, we can use hwinfo to get the CPU speed:

$ hwinfo --cpu | grep Hz Model: 6.142.9 "Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz" Clock: 2904 MHz Model: 6.142.9 "Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz" Clock: 2904 MHz

As can be seen above, we got both the base and current clock speeds as 2.70 GHz and 2904 MHz like before.

9. Using i7z for Intel Processors

i7z is a basic utility that reports processor data, but only about Intel Core CPUs. After installing the package, we can see some real-time status information for every core:

$ sudo i7zCpu speed from cpuinfo 2903.00Mhzcpuinfo might be wrong if cpufreq is enabled. To guess correctly try estimating via tscLinux's inbuilt cpu_khz code emulated nowTrue Frequency (without accounting Turbo) 2903 MHz CPU Multiplier 29x || Bus clock frequency (BCLK) 100.10 MHzSocket [0] - [physical cores=2, logical cores=2, max online cores ever=2] TURBO DISABLED on 2 Cores, Hyper Threading OFF Max Frequency without considering Turbo 2903.00 MHz (100.10 x [29]) Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is 42x/42x/42x/42x Real Current Frequency 0.00 MHz [100.10 x 0.00] (Max of below) Core [core-id] :Actual Freq (Mult.) C0% Halt(C1)% C3 % C6 % Temp VCore Core 1 [0]: inf (infx) 0 100 0 0 -1 1.9349 Core 2 [1]: inf (infx) 0 100 0 0 -1 1.9349...

When we inspect the output, we see that the true frequency of the CPU is 2903 MHz. As we mentioned previously, the true frequency may vary in real-time. Hence this slight difference is not a problem.

10. Conclusion

In this article, we learned what a CPU is and what its speed means. We saw the difference between the base and true frequency and used several methods to retrieve the clock speed information.

How to View CPU Speed on Linux | Baeldung on Linux (2024)

FAQs

How to View CPU Speed on Linux | Baeldung on Linux? ›

Using lscpu

How do I see CPU details in Linux? ›

The command-line utility “lscpu” in Linux is used to get CPU information of the system. The “lscpu” command fetches the CPU architecture information from the “sysfs” and /proc/cpuinfo files and displays it in a terminal.

How do I check my CPU speed? ›

If you're wondering how to check your clock speed, click the Start menu (or click the Windows key) and type “System Information.” Your CPU's model name and clock speed will be listed under “Processor.”

How to check CPU stats in Linux? ›

Check how the CPU is being used with the htop command. This command prints out real-time information, including tasks, threads, load average uptime and usage for each CPU. To run this tool, issue the command htop. A real-time display appears with information on how the CPU is being put to use.

How to check CPU speed in Linux? ›

Using lscpu

We can also use the lscpu command-line utility to retrieve the CPU speed. lscpu collects the general CPU architecture information from the /proc/cpuinfo virtual file and the sysfs pseudo-file system. As we can see from the output of lscpu, the results are 2.70 GHz and 2904.004 MHz, just like before.

How to see CPU usage and RAM in Linux? ›

The Sar command is the simplest way to gather historical system data. It gathers includes CPU, Memory usage, Disk usage, and load to name a few. It gathers this data once every 10 minutes and then when you run the command displays the information in a table.

How do I see my CPU Performance? ›

To check for high CPU usage on a computer, you can use the following methods: Using the Task Manager: Open the Task Manager (Ctrl + Shift + Esc) and go to the “Performance” tab. The CPU usage will display as a graph; if the computer runs high CPU usage, the chart will be primarily red.

How do I check my CPU and RAM speed? ›

You can also use the keyboard shortcut Ctrl+Shift+Esc. Once the Task Manager is open, you can switch between different tabs to see different aspects of your system. For example, you can use the Performance tab to see your CPU speed, memory usage, disk activity, and network activity.

How do I check my CPU temp and speed? ›

To access it, turn on your PC and press a specific key during startup — usually F12, ESC, F2, or DEL. Once BIOS/UEFI is open, you'll find the CPU temperature right on the main screen. This thermometer feature is part of the core software of your motherboard.

How to check CPU utilization in Linux using SAR command? ›

Display the collective usage of all CPUs

The command has the following variations: sar -u : Displays CPU usage for the current day. sar -u 1 3 : Displays real-time CPU usage every 1 second for 3 times. sar -u ALL : Same as the sar -u command, but displays additional fields.

How do I check CPU temp in Linux? ›

Look for Psensor in the application menu and open it. The tool will show you a graph with information like Linux CPU temperature, CPU and memory usage, available RAM, GPU temperature, and HDD temperature.

How to check my CPU speed? ›

Start typing About your PC in the Windows search box and click the option to open it when it appears. In the Device Specifications section, you can find your processor type and speed, its amount of memory (or RAM), and your operating system.

How do I check my CPU hardware in Linux? ›

Some commonly used methods to get CPU info linux include using commands like "lscpu," "cat /proc/cpuinfo," "top" or "htop," "nproc," and utilizing tools such as "hardinfo," "hwinfo," "dmidecode," "inxi," and "lshw." Each method provides specific information about the CPU, enabling you to analyze its capabilities and ...

How can I see my CPU details? ›

Right-click your taskbar and select "Task Manager" or press Ctrl+Shift+Esc to launch it. Click the "Performance" tab and select "CPU." The name and speed of your computer's CPU appear here. (If you don't see the Performance tab, click "More Details.")

Top Articles
Easy Southern Buttermilk Biscuits Recipe
16 Creative Ways to Use Discarded Sourdough Starter
Www.paystubportal.com/7-11 Login
Skamania Lodge Groupon
Valley Fair Tickets Costco
30 Insanely Useful Websites You Probably Don't Know About
Rabbits Foot Osrs
Mlifeinsider Okta
Simple Steamed Purple Sweet Potatoes
What Is Njvpdi
Flights To Frankfort Kentucky
Hellraiser III [1996] [R] - 5.8.6 | Parents' Guide & Review | Kids-In-Mind.com
ARK: Survival Evolved Valguero Map Guide: Resource Locations, Bosses, & Dinos
Jbf Wichita Falls
Erica Banks Net Worth | Boyfriend
Craigslist Appomattox Va
Poe Str Stacking
Brazos Valley Busted Newspaper
Optum Urgent Care - Nutley Photos
Air Quality Index Endicott Ny
Wnem Tv5 Obituaries
6 Most Trusted Pheromone perfumes of 2024 for Winning Over Women
Violent Night Showtimes Near Amc Dine-In Menlo Park 12
Miles City Montana Craigslist
Delta Math Login With Google
Uncovering the Enigmatic Trish Stratus: From Net Worth to Personal Life
Mobile Maher Terminal
Urban Blight Crossword Clue
Walter King Tut Johnson Sentenced
El agente nocturno, actores y personajes: quién es quién en la serie de Netflix The Night Agent | MAG | EL COMERCIO PERÚ
Car Crash On 5 Freeway Today
Craigslist Car For Sale By Owner
Eleceed Mangaowl
Pawn Shop Open Now
Walgreens Agrees to Pay $106.8M to Resolve Allegations It Billed the Government for Prescriptions Never Dispensed
Compare Plans and Pricing - MEGA
Fwpd Activity Log
Unblocked Games Gun Games
Shoecarnival Com Careers
2017 Ford F550 Rear Axle Nut Torque Spec
Tommy Bahama Restaurant Bar & Store The Woodlands Menu
Ratchet And Clank Tools Of Destruction Rpcs3 Freeze
Amateur Lesbian Spanking
Actress Zazie Crossword Clue
Joy Taylor Nip Slip
Guy Ritchie's The Covenant Showtimes Near Look Cinemas Redlands
About us | DELTA Fiber
Zadruga Elita 7 Live - Zadruga Elita 8 Uživo HD Emitirani Sat Putem Interneta
Assignation en paiement ou injonction de payer ?
Tyrone Unblocked Games Bitlife
Ics 400 Test Answers 2022
Overstock Comenity Login
Latest Posts
Article information

Author: Dong Thiel

Last Updated:

Views: 6020

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.