Skip to content

Instantly share code, notes, and snippets.

@drichline
Created November 30, 2024 21:02
Show Gist options
  • Select an option

  • Save drichline/55ac199d5100763ea18b6050f2dd2721 to your computer and use it in GitHub Desktop.

Select an option

Save drichline/55ac199d5100763ea18b6050f2dd2721 to your computer and use it in GitHub Desktop.
motd.sh
#!/bin/bash
# System info
echo -e " System info on......: $(date '+%H:%M %Y-%m-%d')"
echo -e " Hostname............: $(cat /etc/hostname)"
echo -e " Last login..........: $(last -w | head -n1 | tr -s ' ' | cut -f1 -d' ') from $(last -w | head -n1 | tr -s ' ' | cut -f3 -d' ')"
echo -e " Uptime..............: $(uptime -p | sed 's/^up.//')"
echo -e " Load Averages.......: $(cat /proc/loadavg | cut -f1 -d' '), $(cat /proc/loadavg | cut -f2 -d' '), $(cat /proc/loadavg | cut -f3 -d' ')"
echo -e " Memory..............: Used: $(free -m | grep Mem: | xargs | cut -f3 -d' ')M | Free: $(free -m | grep Mem: | xargs | cut -f7 -d' ')M | Total: $(free -m | grep Mem: | xargs | cut -f2 -d' ')M"
echo -e " CPU Temperature.....: $(sensors | grep Package | cut -f2 -d'+' | cut -f1 -d' ')"
echo -e " Root disk...........: Used: $(df -h / | tail -n1 | tr -s ' ' | cut -f3 -d' ') | Free: $(df -h / | tail -n1 | tr -s ' ' | cut -f4 -d' ') | Total: $(df -h / | tail -n1 | tr -s ' ' | cut -f2 -d' ')"
echo -e " slab................: Status:$(zpool status slab | grep state | cut -d: -f2) | Used: $(zfs list | tail -n1 | tr -s ' ' | cut -f2 -d' ') | Free: $(zfs list | tail -n1 | tr -s ' ' | cut -f3 -d' ')"
#echo -e " Available Updates...: There are $(apt list --upgradeable 2>/dev/null | grep upgradable | wc -l) updates available"
#echo -e " Available Updates...: There are $(yum check-update --quiet | grep -v "^$" | wc -l) updates
echo -e " Ethernet............: $(ip addr show dev eno1 up | grep 'UP' | cut -f9 -d' ')"
echo -e " Wi-Fi...............: $(ip addr show dev wlp2s0 up | grep 'UP' | cut -f9 -d' ')"
echo -e " SSH Logins..........: $(who | wc -l)"
echo -e " Processes...........: $(ps -ef | wc -l)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment