Created
February 3, 2019 12:51
-
-
Save franky47/cf32234a9f0883674a5b8cfd64ccc289 to your computer and use it in GitHub Desktop.
System status MOTD for Raspberry Pi (with ZSH)
This file contains 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
# Inspiration: https://www.raspberrypi.org/forums/viewtopic.php?t=23440 | |
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %dh %dm %ds" "$days" "$hours" "$mins" "$secs"` | |
# get the load averages | |
read one five fifteen rest < /proc/loadavg | |
echo "$(tput setaf 2) | |
$(tput setaf 2) .~~. .~~. `date +"%A, %d %B %Y, %R"` | |
$(tput setaf 2) '. \ ' ' / .' `uname -srmo` | |
$(tput setaf 1) .~ .~~~..~. | |
$(tput setaf 1) : .~.'~'.~. : $(tput setaf 6)Uptime $(tput setaf 7) ${UPTIME} | |
$(tput setaf 1) ~ ( ) ( ) ~ $(tput setaf 6)Memory Usage $(tput setaf 7) `free | grep Mem | awk '{printf("%0.2f", $3/$2 * 100.0) }'`% | |
$(tput setaf 1)( : '~'.~.'~' : ) $(tput setaf 6)Disk Usage $(tput setaf 7) `df -hl | grep '/dev/root' | awk '{ print $3 " (" $5")" }'` | |
$(tput setaf 1) ~ .~ ( ) ~. ~ $(tput setaf 6)Load Averages $(tput setaf 7) ${one}, ${five}, ${fifteen} (1, 5, 15 min) | |
$(tput setaf 1) ( : '~' : ) $(tput setaf 6)Running Processes $(tput setaf 7) `ps ax | wc -l` | |
$(tput setaf 1) '~ .~~~. ~' $(tput setaf 6)IP Addresses $(tput sgr0) int $(tput setaf 7)`/sbin/ifconfig enxb827eb45320a | grep "inet 192" | awk '{ print $2 }'` | |
$(tput setaf 1) '~' $(tput setaf 6) $(tput sgr0) ext $(tput setaf 7)`wget -q -O - https://icanhazip.com/ | tail` | |
$(tput sgr0)" |
Author
franky47
commented
Feb 3, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment