Skip to content

Instantly share code, notes, and snippets.

@bmegli
Last active April 5, 2021 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmegli/f1a9c22a92ec650bef1816c0ee4a64a5 to your computer and use it in GitHub Desktop.
Save bmegli/f1a9c22a92ec650bef1816c0ee4a64a5 to your computer and use it in GitHub Desktop.
Linux performance/powersafe switching scripts

Scripts

cat performance.sh 
#! /bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
cat powersafe.sh 
#! /bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

To use:

  • chmod +x scriptname (once)
  • use sudo for calling the script

Usage

# put into performance mode
sudo ./performance.sh
# put into powersafe mode
sudo ./powersafe.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment