The cpufreq-set command is a utility in Linux that is used to adjust the CPU frequency scaling settings of a system. CPU frequency scaling is the process of adjusting the speed at which a CPU is able to process instructions in order to save energy or improve performance.
To set the CPU frequency to a specific value, use the following command:
# cpufreq-set -f FREQUENCY -c CPU
This will set the frequency of the specified CPU to the specified value.
If you encounter the below error while running the command cpufreq-set:
cpufreq-set: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install cpufrequtils |
Ubuntu | apt-get install cpufrequtils |
Alpine | apk add cpufrequtils |
Kali Linux | apt-get install cpufrequtils |
CentOS | yum install cpufrequtils |
Raspbian | apt-get install cpufrequtils |
cpufrequtils Command Examples
1. Set the CPU frequency policy of CPU 1 to “userspace”:
# sudo cpufreq-set -c 1 -g userspace
2. Set the current minimum CPU frequency of CPU 1:
# sudo cpufreq-set -c 1 --min min_frequency
3. Set the current maximum CPU frequency of CPU 1:
# sudo cpufreq-set -c 1 --max max_frequency
4. Set the current work frequency of CPU 1:
# sudo cpufreq-set -c 1 -f work_frequency