Skip to content

Instantly share code, notes, and snippets.

@piksel
Last active August 14, 2017 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save piksel/4592633 to your computer and use it in GitHub Desktop.
Save piksel/4592633 to your computer and use it in GitHub Desktop.
overclocking status for the raspberry pi shell script
#!/bin/bash
#
# ocstat - overclocking status for the raspberry pi
#
# relies on bc for calculations, if you get a command not found error, run:
# sudo apt-get install bc
#
echo -n " Freq: "
cat /boot/config.txt | grep _freq | tr -t '\n' ' ' | sed 's/_freq//g'
echo ""
echo -n " Overvolt: "
cat /boot/config.txt | grep over_voltage | tr -d 'over_voltage='
echo -n "Temperature: "
echo -e "$(echo "scale=2;$(</sys/class/thermal/thermal_zone0/temp)/1000" | bc)\xc2\xb0C"
echo -n "CPU Scaling: "
echo "$(echo "scale=2;$(</sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)/1000" | bc) MHz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment