Skip to content

Instantly share code, notes, and snippets.

@aelveborn
Last active February 18, 2021 15:39
Show Gist options
  • Save aelveborn/8127860 to your computer and use it in GitHub Desktop.
Save aelveborn/8127860 to your computer and use it in GitHub Desktop.
Bash script to enable / disable turbo on the CPU in Linux. Change permissions: sudo chmod a+x switch-turbo.sh Run the script: sudo ./switch-turbo.sh
#!/bin/bash
status=$(head /sys/devices/system/cpu/intel_pstate/no_turbo | grep -o '[0-1]')
if [ $status = 0 ]; then
echo "Switching CPU-turbo: OFF"
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
else
echo "Switching CPU-turbo: ON"
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
fi
@roguepullrequest
Copy link

Useful but over on my branch I cleaned up the subcommand for status. Nothing much but is a bit cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment