~kris/dots

srice

ref: e98f3b030dc24445bd55c68d95d2d81933fd68b3 srice/.local/bin/sysinfo -rw-r--r-- 882 bytes
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# sysinfo -- quick system overview
set -eu

printf "%-12s %s\n" "Hostname:" "$(hostname)"
printf "%-12s %s\n" "Kernel:" "$(uname -r)"
printf "%-12s %s\n" "Uptime:" "$(uptime -p 2>/dev/null || uptime | awk '{print $3,$4}')"
printf "%-12s %s cores\n" "CPU:" "$(nproc)"
printf "%-12s %s\n" "Memory:" "$(free -h | awk '/Mem:/ {print $3 "/" $2}')"
printf "%-12s %s\n" "Disk /:" "$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}')"
printf "%-12s %s\n" "Load:" "$(cut -d' ' -f1-3 /proc/loadavg 2>/dev/null || sysctl -n vm.loadavg 2>/dev/null || echo 'N/A')"

# Network
if command -v ip >/dev/null 2>&1; then
    printf "%-12s %s\n" "IP:" "$(ip route get 1.1.1.1 2>/dev/null | awk '{print $7; exit}')"
fi

# Tailscale
if command -v tailscale >/dev/null 2>&1; then
    tsip=$(tailscale ip -4 2>/dev/null || echo "not connected")
    printf "%-12s %s\n" "Tailscale:" "$tsip"
fi