Created
September 11, 2021 05:59
-
-
Save laalaguer/187b7015aae9b03e5141af5a83586540 to your computer and use it in GitHub Desktop.
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
# CPU temperature | |
read temperature < /sys/class/thermal/thermal_zone0/temp | |
printf "CPU:\t%s °C\n" $(($temperature/1000)) | |
# Memory pressure | |
memtotal=0 | |
memfree=0 | |
while read -r name value unit; do | |
if [ "${name}" == "MemTotal:" ]; then | |
memtotal=${value} | |
fi | |
if [ "${name}" == "MemFree:" ]; then | |
memfree=${value} | |
fi | |
done < /proc/meminfo | |
mempercent=$(( 100 - $memfree * 100 / $memtotal )) | |
printf "Memory:\t%s %%\n" ${mempercent} | |
printf 'Total:\t%s MB\n' "$(( $memtotal/1024 ))" | |
printf 'Free:\t%s MB\n' "$(( $memfree/1024 ))" | |
# IP Address (primary) | |
addr=$(ip route get 8.8.8.8 | head -1 | cut -d' ' -f7) | |
printf "IP:\t%s\n" "${addr}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment