Linux Commands

How Do I Find CPU Frequency in Linux?


The Central Processing Unit (CPU) is considered an essential component in any system. It is also referred the “Computer’s Brain” because it handles all kinds of data processing operations. CPU is embedded in any system based on various specifications; frequency is one of them. The CPU frequency is also known as Clock speed or Clock rate. The clock speed of your CPU figures out how quickly it can process instructions per second. It is a unit of measurement for the number of your CPU execution, expressed in MHz or GHz.

But have you ever thought of knowing what kind of CPU your computer has and how fast it runs? There exist many reasons why you would want to know what CPU you have in your system. Perhaps you are troubleshooting any hardware issue or loading a kernel module. Whatever the cause is, determining the CPU speed and type from the command line is quite easy in Linux. Several commands can be utilized for obtaining information about your processor, including CPU frequency. In this article, we have compiled some of those commands to get to know your CPU better.

Dmseg command

Dmseg is used for showing messages from the ring buffer of the kernel. In the following example, we have combined the Dmseg command with grep for filtering out the CPU speed from other related information.

$ sudo dmesg | grep MHz

lscpu command

lscpu command helps you to know about your CPU architecture. Lscpu pre-exists in the util-Linux package. Write out the below-given command in your terminal.

$ sudo lscpu

In the output, check out the “CPU MHz.”

i7z command

i7z is an exclusive tool for retrieving the processor states in Intel-based CPUs such as i3, i5, and i7.

$ sudo i7z

Executing this command will provide you the following information:

Retrieving CPU speed from “/proc/cpuinfo” file

The “/proc/cpuinfo” file has all content related to the individual CPU cores. Now we will utilize the ‘grep’ and ‘cat’ command to only extract the information about the CPU speed from this file.

$ cat /proc/cpuinfo | grep MHz

Instead of using “grep,” you can also use the “less” command for the same execution purpose.

$ less /proc/cpuinfo

hwinfo command

In the terminal, the detailed information about each hardware device can be printed using “hwinfo.” We will specify the “–cpu” parameter in the “hwinfo” command for displaying only the CPU speed.

$ sudo hwinfo --cpu

inxi script

inxi is a powerful Linux script that permits you to print out the system’s hardware details. Execute the inxi command in your terminal with the “-C” option for displaying the processor-related information.

$ sudo inxi -C

Conclusion:

As a result of efficient technology, we have developed a need for speed everywhere we go. CPU and its frequency or clock speed are the most widely associated characteristics with the high-performance of any computer. This post looks at how to get CPU speed details using various commands in Linux.

About the author

Talha Saif Malik

Talha is a contributor at Linux Hint with a vision to bring value and do useful things for the world. He loves to read, write and speak about Linux, Data, Computers and Technology.