Last active
May 15, 2026 22:23
-
-
Save tunalad/2fe95c6adafab8652f0d0c6c91a55de6 to your computer and use it in GitHub Desktop.
statusbar for the shell, written for my raspberry pi (but works everywhere
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
| #!/bin/sh | |
| pistatus() { | |
| temp="NaN" | |
| if [ -r /sys/class/thermal/thermal_zone0/temp ]; then | |
| raw=$(cat /sys/class/thermal/thermal_zone0/temp) | |
| deg=$((raw / 1000)) | |
| temp="${deg}C°" | |
| [ "$raw" -ge 80000 ] && temp="WARN:${temp}" | |
| fi | |
| load=$(cut -d' ' -f1 /proc/loadavg) | |
| total=$(awk '/^MemTotal:/{print $2}' /proc/meminfo) | |
| available=$(awk '/^MemAvailable:/{print $2}' /proc/meminfo) | |
| used=$(((total - available) / 1024)) | |
| total=$((total / 1024)) | |
| disk=$(df -h / | awk 'NR==2{print $3"/"$2" ("$5")"}') | |
| up=$(awk '{s=int($1); d=s/86400; h=s%86400/3600; m=s%3600/60; printf "%dd %dh %dm", d, h, m}' /proc/uptime | sed 's/^0d //') | |
| printf '\e[2m[temp:%s|load:%s|ram:%dM/%dM|disk:%s|up:%s]\e[0m\n' \ | |
| "$temp" "$load" "$used" "$total" "$disk" "$up" | |
| } | |
| if echo "$-" | grep -q i; then | |
| PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }pistatus" | |
| bind -x '"\C-l": clear; pistatus' | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment