Created
February 11, 2026 14:10
-
-
Save Guiorgy/e4e976ebd8d80f39820b92f83c8aaa9f to your computer and use it in GitHub Desktop.
A simple shell script to monitor the temperatures in Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # ============================================================================= # | |
| # Copyright © 2026 Guiorgy # | |
| # # | |
| # This program is free software: you can redistribute it and/or modify it under # | |
| # the terms of the GNU General Public License as published by the Free Software # | |
| # Foundation, either version 3 of the License, or (at your option) any later # | |
| # version. # | |
| # # | |
| # This program is distributed in the hope that it will be useful, but WITHOUT # | |
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
| # FOR A PARTICULAR PURPOSE. # | |
| # # | |
| # You can see the full GNU General Public License at # | |
| # <https://www.gnu.org/licenses/> for more details. # | |
| # ============================================================================= # | |
| read -r -d '' COMMANDS <<'EOF' | |
| # Read temperatures from /sys/class/thermal/thermal_zone* | |
| for zone in /sys/class/thermal/thermal_zone*; do | |
| temp_raw=$(cat "$zone/temp") | |
| type=$(cat "$zone/type") | |
| temp_int=$(( temp_raw / 1000 )) | |
| temp_dec=$(( (temp_raw - temp_int * 1000) / 100 )) | |
| temp="${temp_int}.${temp_dec}" | |
| printf "%-15s : %sC\n" "$type" "$temp" | |
| done | |
| EOF | |
| watch -n "${1-2}" "$COMMANDS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment