CPU frequency is one of the best indicators of your machine’s overall speed and performance. It determines, along with CPU threads, how fast a program can run its instructions on the silicon die. Your base CPU frequency is also a good indicator of how much power your computer consumes, with a higher base frequency pointing to more electricity consumption.
With this information in mind, in this tutorial, we show you the basics of checking your system’s CPU frequency in Ubuntu. We also highlight how you can control the base frequency to either boost your machine’s performance or extend its battery life.
How to Check Your System’s CPU Frequency
The first step in controlling your machine’s CPU frequency is to find out how fast your computer is currently running. You can use any of the methods we cover here.
Using dmesg
One of the quickest ways to find the base frequency is through dmesg
, a built-in utility that displays every status message from your kernel.
Run the following command to check your machine’s base frequency:
sudo dmesg | grep MHz
This command will first load the entire status buffer in your computer’s memory, then display every line of text that contains “MHz.”
It is important to note that this command will also print any line in the buffer that has a clock frequency value. To fix this issue, you can either look for a “processor” string in the terminal output or use a more specific grep keyword:
sudo dmesg | grep "MHz processor"
Reading the Base Frequency Using lscpu
You can also use the lscpu
utility to check your processor’s base frequency. Unlike dmesg
, lscpu
is a program that only displays the properties and features of your CPU.
To check your processor’s base frequency with lscpu
, run the following command:
lscpu | grep "MHz"
Running this command will print two clock frequency values:
- CPU max MHz: shows the maximum allowable speed for your particular CPU die. This is helpful if you intend to overclock your processor.
- CPU min MHz: shows the base CPU frequency for your particular processor.
Using hardinfo to Print System Information
Lastly, it is also possible to check your processor’s base frequency through a graphical user interface (GUI), which is especially useful if you are not yet comfortable with the command line.
- Run the following command to install the GUI:
sudo apt install hardinfo
- Run the GUI by pressing Win and typing “hardinfo.”
- The previous step will load a small “System Information” window that contains details about every device on your computer. Once inside, press the “Refresh” button to get the current system data.
- From there, press the “Processor” entry under the “Devices” section to print all the information about your processor.
- You can now check your machine’s current CPU frequency beside the “Frequency” entry in the “Configuration” group.
Using CPU Power Manager in Ubuntu to Control CPU Speed
Once you know the base CPU frequency of your computer, you can start tweaking how your processor performs under load by installing the “CPU Power Manager” applet. This is a small extension for GNOME (similar to Hide Top Bar, which is used to hide the top bar in Ubuntu). It provides an easy-to-use interface for manipulating your CPU’s overall speed.
- Obtain the GNOME Extensions program to install the CPU Power Manager applet:
sudo apt install chrome-gnome-shell
- Install the browser add-on that will link the Extensions website to your main program by going to the GNOME Extensions website and clicking “Click here to install browser extension.”
- Install the “CPU Power Manager” applet on your Ubuntu machine by going back to the GNOME Extensions website, typing “cpu power manager” in the search box, and clicking the applet’s name in the results.
- Click the small black switch in the top-right corner of the applet’s page to enable it on your system.
How to Control the CPU Frequency With CPU Power Manager
View your options of tweaking your processor’s frequency clock by opening the CPU Power Manager applet via the processor icon in your taskbar. The options available are as follows:
- Minimum Frequency: tells the applet to keep the CPU at a certain load percentage at all times. For example, keeping this value at 50% will force the processor to make sure that half of its resources are always active.
- Maximum Frequency: determines how much of the CPU you can use at any point in time. Unlike the Minimum Frequency, setting this value at 50% will force the processor to use only half of its resources regardless of load.
- Current Frequency: displays the speed at which your processor is running at the moment, which is handy when you want to quickly check the speed of your CPU.
- Built-in profiles: allow you to adjust your processor’s frequency policy. Clicking the “High Performance” profile, for example, will set the Minimum Frequency to 50% and the Maximum to 100%.
How to Create a Custom CPU Frequency Profile
Along with using built-in frequency policies, it is also possible to create your own custom profile for your computer via the “Preferences” section in the applet’s menu.
- Click on “Preferences” to open a small window that contains all of the possible options and settings for the CPU Power applet. Press the “Profiles” tab.
- Create a new frequency profile by pressing the “+” button in the lower-left corner of the window.
- A small dialog will open and ask you for a name as well as a minimum and maximum frequency for your new custom profile. Once you enter these details, press “Save” to commit your new profile to the applet.
Frequently Asked Questions
I am getting a "command not found" error when I run lscpu. How do I fix this?
One of the reasons a “command not found” error occurs in Ubuntu is that the command that you are trying to run does not exist in the system. One way to fix this issue is to make sure that the command – lscpu
, in this case – is present in the machine. Run sudo apt install util-linux
to force Ubuntu to recheck the lscpu
package.
I am getting a "native host not detected" error when using GNOME Extensions. Is my system broken?
No! This issue is most likely due to your current browser being under a sandbox environment. Since Ubuntu 22.04, the default Firefox browser that comes with the system is a Snap package, which means it will not be able to see and communicate with any other program in your system.
To fix this, remove the Firefox snap package with sudo snap remove firefox
, then install the proper Firefox browser by running the following command: sudo add-apt-repository ppa:mozillateam/ppa && sudo apt install firefox
.
Is it possible to set my Minimum and Maximum Frequency to 100% in CPU Power Manager?
Yes. However, setting your system to always be on full load can damage the entire machine, as forcing your processor to always use its entire resource pool will also force your system’s memory to always be active. This can especially be an issue if you are using an old memory stick for your machine.
Knowing that, a good rule of thumb in to set the Minimum and Maximum frequency for your machine to ensure that the gap between the two values is around 30% to 50%.
Image credit: Brian Balliet via Unsplash. All alterations and screenshots by Ramces Red.
Our latest tutorials delivered straight to your inbox