Software & AppsOperating SystemLinux

How To Change CPU Frequency in Ubuntu 18.04

Ubuntu 15

In this article, we will delve into the process of changing the CPU frequency in Ubuntu 18.04, also known as Bionic Beaver. This can be particularly useful for managing your system’s temperature and noise levels. However, it’s important to note that altering the maximum frequency may result in reduced performance, so it’s crucial to monitor your system to ensure it meets your requirements.

Quick Answer

To change the CPU frequency in Ubuntu 18.04, you can use the terminal to adjust the maximum frequency. However, it’s important to note that altering the frequency may result in reduced performance, so it’s crucial to monitor your system to ensure it meets your requirements. Additionally, you can use third-party tools like the "cpufreq" project for a graphical user interface option.

Understanding CPU Frequencies

Before we begin, let’s understand what CPU frequencies are. The CPU, or Central Processing Unit, operates at a certain speed, known as its frequency, which is measured in MHz (Megahertz) or GHz (Gigahertz). This frequency can often be adjusted to either increase performance or reduce power consumption and heat.

Checking Current CPU Frequencies

To check your current CPU frequencies, you can use the terminal in Ubuntu. The following command will display the minimum, current, and maximum frequencies for each CPU core:

$ paste <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq) | column -s $'\t' -t

In this command:

  • cat reads the file content.
  • /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq, /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq and /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq are file paths that contain the minimum, current, and maximum frequencies respectively.
  • paste and column commands are used to format the output in a readable way.

Changing the Maximum CPU Frequency

To change the maximum CPU frequency, you can use the following command:

for x in /sys/devices/system/cpu/*/cpufreq/; do echo 1700000 | sudo tee $x/scaling_max_freq; done

This command will set the maximum frequency to 1700000 MHz (or 1.7 GHz) for all CPU cores. You can adjust this value as per your preference.

In this command:

  • for x in /sys/devices/system/cpu/*/cpufreq/ loops through all CPU cores.
  • echo 1700000 sets the new maximum frequency.
  • sudo tee $x/scaling_max_freq writes the new frequency to the appropriate file.

Remember, you cannot set the maximum frequency higher than the default value.

Making the Change Permanent

If you want to make this change permanent, you can add the above command to your startup scripts or create a systemd service. This way, the change will persist even after you reboot your system.

Using Third-Party Tools

If you prefer a graphical user interface (GUI), you can use third-party tools like the “cpufreq” project available on GitHub. It provides a GNOME extension to easily control the number of active cores and CPU frequency. You can find the installation instructions in the project’s README.md file.

Conclusion

Changing the CPU frequency in Ubuntu 18.04 can be a useful technique for managing your system’s performance and temperature. However, it’s important to monitor your system after making these changes to ensure it continues to meet your needs. Always remember to proceed with caution when making changes to system files.

Can changing the CPU frequency in Ubuntu 18.04 improve the performance of my system?

Yes, increasing the CPU frequency can potentially improve the performance of your system by allowing it to process tasks faster. However, it’s important to note that increasing the frequency too much may result in higher power consumption and heat generation.

Can changing the CPU frequency in Ubuntu 18.04 reduce power consumption?

Yes, reducing the CPU frequency can help reduce power consumption as it lowers the amount of energy consumed by the processor. This can be beneficial for extending battery life on laptops or reducing overall power usage on desktop systems.

Is it safe to change the CPU frequency in Ubuntu 18.04?

Yes, it is generally safe to change the CPU frequency in Ubuntu 18.04. However, it’s important to monitor your system after making changes to ensure stability and performance meet your requirements. If you experience any issues, you can always revert back to the default frequency settings.

Can changing the CPU frequency in Ubuntu 18.04 damage my hardware?

Changing the CPU frequency within safe limits should not damage your hardware. Modern processors are designed to handle frequency adjustments without causing harm. However, extreme overclocking or setting frequencies too high can potentially lead to overheating and instability, which may damage the hardware over time.

How can I check the current CPU frequencies in Ubuntu 18.04?

To check the current CPU frequencies, you can open the terminal and use the command mentioned in the article: $ paste <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq) | column -s $'\t' -t. This will display the minimum, current, and maximum frequencies for each CPU core.

How can I revert back to the default CPU frequencies in Ubuntu 18.04?

To revert back to the default CPU frequencies, you can remove any changes you made to the maximum frequency by using the command: for x in /sys/devices/system/cpu/*/cpufreq/; do echo 0 | sudo tee $x/scaling_max_freq; done. This will set the maximum frequency back to its default value.

Leave a Comment

Your email address will not be published. Required fields are marked *