WILLYDOS_SOL

cputemp.sh

Nov 27th, 2023 (edited)
103
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 KB | None | 1 0
  1. #!/bin/sh
  2. ncupus=`sysctl -n hw.ncpu`
  3. while :; do
  4.     echo -e "\ec\e[1mCPU Temperature\e[0m \e[3m[press ^C to exit]\e[0m"
  5.     for cpus in `seq 0 $((${ncpus}-1))`; do
  6.         printf "%s %3s %s%6s \t%s%5s\n"\
  7.         "cpu" $cpus\
  8.         "temp:" `sysctl -n dev.cpu.$cpus.temperature`\
  9.         "freq:" `sysctl -n dev.cpu.$cpus.freq`
  10.     done
  11.     sleep 0.2
  12.     echo -e '\r\e['$((${ncpus}+1))'A'
  13. done
Add Comment
Please, Sign In to add comment