Created
July 12, 2026 09:28
-
-
Save kibotu/62a0590a46f28522255472f47764a178 to your computer and use it in GitHub Desktop.
RasberryPi Status on ssh connect
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/bash | |
| # Uptime | |
| upSeconds=$(cut -d. -f1 /proc/uptime) | |
| days=$((upSeconds / 86400)) | |
| hours=$((upSeconds / 3600 % 24)) | |
| mins=$((upSeconds / 60 % 60)) | |
| secs=$((upSeconds % 60)) | |
| UPTIME=$(printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs") | |
| # Load averages | |
| read one five fifteen _ < /proc/loadavg | |
| # Memory | |
| MEM_FREE=$(awk '/MemAvailable:/ {print $2}' /proc/meminfo) | |
| MEM_TOTAL=$(awk '/MemTotal:/ {print $2}' /proc/meminfo) | |
| # Running processes | |
| PROCESSES=$(ps -e --no-headers | wc -l) | |
| # CPU temperature | |
| if command -v vcgencmd >/dev/null 2>&1; then | |
| CPU_TEMP=$(vcgencmd measure_temp | cut -d= -f2) | |
| else | |
| CPU_TEMP="N/A" | |
| fi | |
| # Disk space | |
| DISK_SPACE=$(df -h / | awk 'NR==2 {print $4 " of " $2}') | |
| # IP addresses | |
| LOCAL_IP=$(hostname -I | awk '{print $1}') | |
| if command -v curl >/dev/null 2>&1; then | |
| PUBLIC_IP=$(curl -4 -fs --max-time 3 https://api.ipify.org 2>/dev/null) | |
| elif command -v wget >/dev/null 2>&1; then | |
| PUBLIC_IP=$(wget -qO- https://api.ipify.org 2>/dev/null) | |
| else | |
| PUBLIC_IP="N/A" | |
| fi | |
| PUBLIC_IP=${PUBLIC_IP:-N/A} | |
| # Output | |
| echo "$(tput setaf 2) | |
| .~~. .~~. $(date '+%A, %e %B %Y, %X %Z') | |
| '. \ ' ' / .' $(uname -srmo)$(tput setaf 1) | |
| .~ .~~~..~. | |
| : .~.'~'.~. : Uptime.............: ${UPTIME} | |
| ~ ( ) ( ) ~ Memory.............: ${MEM_FREE}kB (Available) / ${MEM_TOTAL}kB (Total) | |
| ( : '~'.~.'~' : ) Load Averages......: ${one}, ${five}, ${fifteen} (1, 5, 15 min) | |
| ~ .~ ( ) ~. ~ Running Processes..: ${PROCESSES} | |
| ( : '~' : ) CPU Temperature....: ${CPU_TEMP} | |
| '~ .~~~. ~' Free Disk Space....: ${DISK_SPACE} | |
| '~' IP Addresses.......: ${LOCAL_IP} and ${PUBLIC_IP} | |
| $(tput sgr0)" | |
| # Load user's bash configuration | |
| if [ -f ~/.bashrc ]; then | |
| source ~/.bashrc | |
| fi |
kibotu
commented
Jul 12, 2026
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment