Skip to content

Instantly share code, notes, and snippets.

@enrialonso
Created October 9, 2021 23:20
Show Gist options
  • Save enrialonso/c918c47e412237187b4703c2662aa72f to your computer and use it in GitHub Desktop.
Save enrialonso/c918c47e412237187b4703c2662aa72f to your computer and use it in GitHub Desktop.

Revisions

  1. enrialonso created this gist Oct 9, 2021.
    12 changes: 12 additions & 0 deletions get_cpu_temp_raspbery_pi_4.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    ### Get temperature of CPU Raspberry PI 4

    ```bash
    #!/bin/bash
    cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
    cpuTemp1=$(($cpuTemp0/1000))
    cpuTemp2=$(($cpuTemp0/100))
    cpuTempM=$(($cpuTemp2 % $cpuTemp1))

    echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"

    ```