R='\e[0m' B='\e[1m' D='\e[2m'
RED='\e[38;5;203m' GRN='\e[38;5;114m' YEL='\e[38;5;222m'
BLU='\e[38;5;111m' CYN='\e[38;5;116m' MAG='\e[38;5;183m' GRY='\e[38;5;242m' WHT='\e[38;5;255m'
_cols=$(tput cols 2>/dev/null || echo 60)
cols=$(( _cols < 60 ? _cols : 60 ))
line() { printf " ${GRY}"; printf '%.0s-' $(seq 1 $(( cols - 4 ))); printf "${R}\n"; }
section() { echo ""; printf " ${1}${B}== %s ==${R}\n" "$2"; line; }
kv() { local c="${3:-$WHT}"; printf " ${GRY}%-20s${R} ${c}%s${R}\n" "$1" "$2"; }
bar() {
local label="$1" used="$2" total="$3" color="$4" unit="${5:-}" w=25
local pct=0
[[ $total -gt 0 ]] && pct=$(( used * 100 / total ))
local filled=$(( pct * w / 100 ))
local empty=$(( w - filled ))
[[ $pct -gt 80 ]] && color="$RED"
[[ $pct -gt 60 && $pct -le 80 ]] && color="$YEL"
local bar_f="" bar_e=""
for ((j=0; j<filled; j++)); do bar_f+="#"; done
for ((j=0; j<empty; j++)); do bar_e+="-"; done
if [[ -n "$unit" ]]; then
printf " ${GRY}%-16s${R} [${color}%s${GRY}%s${R}] ${WHT}%3d%%${R} ${GRY}(%s / %s %s)${R}\n" \
"$label" "$bar_f" "$bar_e" "$pct" "$used" "$total" "$unit"
else
printf " ${GRY}%-16s${R} [${color}%s${GRY}%s${R}] ${WHT}%3d%%${R} ${GRY}(%s / %s)${R}\n" \
"$label" "$bar_f" "$bar_e" "$pct" "$used" "$total"
fi
}
clear
echo ""
printf " ${CYN}${B}== System Info ==${R}\n"
printf " ${GRY}$(date '+%Y-%m-%d %H:%M:%S')${R}\n"
section "$BLU" "Network"
kv "Hostname" "$(hostname)" "$CYN"
kv "Primary IP" "$(ip route get 1.1.1.1 2>/dev/null | awk '{for(i=1;i<=NF;i++) if($i=="src") print $(i+1)}' || echo 'n/a')" "$WHT"
kv "All IPs" "$(hostname -I 2>/dev/null || echo 'n/a')" "$GRY"
kv "Default Gateway" "$(ip route 2>/dev/null | awk '/default/{print $3}' || echo 'n/a')"
section "$MAG" "OS & Kernel"
kv "Distribution" "$(lsb_release -ds 2>/dev/null || grep PRETTY /etc/os-release 2>/dev/null | cut -d= -f2 | tr -d '"' || echo 'n/a')" "$MAG"
kv "Kernel" "$(uname -r)"
kv "Architecture" "$(uname -m)"
section "$GRN" "Uptime"
kv "Uptime" "$(uptime -p 2>/dev/null || echo 'n/a')" "$GRN"
kv "Last Boot" "$(who -b 2>/dev/null | awk '{print $3" "$4}' || echo 'n/a')"
kv "Logged-in Users" "$(who 2>/dev/null | wc -l || echo '0')"
section "$YEL" "CPU"
CPU_MODEL=$(lscpu 2>/dev/null | awk -F: '/Model name/{gsub(/^[ \t]+/,"",$2); print $2}' || echo 'n/a')
CPU_CORES=$(nproc 2>/dev/null || echo '?')
LOAD_1=$(awk '{print $1}' /proc/loadavg 2>/dev/null || echo '0')
LOAD_5=$(awk '{print $2}' /proc/loadavg 2>/dev/null || echo '0')
LOAD_15=$(awk '{print $3}' /proc/loadavg 2>/dev/null || echo '0')
kv "Model" "$CPU_MODEL" "$YEL"
kv "Cores" "$CPU_CORES"
printf " ${GRY}%-20s${R} ${WHT}%s${R} ${GRY}|${R} ${WHT}%s${R} ${GRY}|${R} ${WHT}%s${R} ${GRY}(1m / 5m / 15m)${R}\n" \
"Load Average" "$LOAD_1" "$LOAD_5" "$LOAD_15"
section "$CYN" "Memory"
TOTAL_MEM=$(awk '/MemTotal/{printf "%d", $2/1024}' /proc/meminfo)
AVAIL_MEM=$(awk '/MemAvailable/{printf "%d", $2/1024}' /proc/meminfo)
USED_MEM=$(( TOTAL_MEM - AVAIL_MEM ))
SWAP_TOTAL=$(awk '/SwapTotal/{printf "%d", $2/1024}' /proc/meminfo)
SWAP_FREE=$(awk '/SwapFree/{printf "%d", $2/1024}' /proc/meminfo)
SWAP_USED=$(( SWAP_TOTAL - SWAP_FREE ))
bar "RAM" "$USED_MEM" "$TOTAL_MEM" "$CYN" "MB"
[[ $SWAP_TOTAL -gt 0 ]] && bar "Swap" "$SWAP_USED" "$SWAP_TOTAL" "$BLU" "MB"
section "$GRN" "Disk"
while read -r mount used total pct; do
pct_num=${pct%\%}
bar "$mount" "$pct_num" "100" "$GRN"
printf " ${GRY}%-16s${R} ${GRY}used %s of %s${R}\n" "" "$used" "$total"
done < <(df -h --output=target,used,size,pcent -x tmpfs -x devtmpfs 2>/dev/null | tail -n +2 | awk '{print $1, $2, $3, $4}')
section "$RED" "Top Processes"
printf " ${D}%-8s %-20s %6s %6s${R}\n" "PID" "COMMAND" "CPU%" "MEM%"
line
ps -eo pid,comm,%cpu,%mem --sort=-%cpu 2>/dev/null | head -n 6 | tail -n 5 | while read -r pid cmd cpu mem; do
printf " ${GRY}%-8s${R} ${WHT}%-20s${R} ${YEL}%6s${R} ${CYN}%6s${R}\n" "$pid" "$cmd" "$cpu" "$mem"
done
section "$GRN" "Services"
FAILED=$(systemctl --failed --no-legend 2>/dev/null | wc -l || echo 0)
if [[ "$FAILED" -eq 0 ]]; then
printf " ${GRN}*${R} ${GRN}All services running${R}\n"
else
printf " ${RED}*${R} ${RED}${FAILED} failed service(s):${R}\n"
systemctl --failed --no-pager --no-legend 2>/dev/null | while read -r svc _rest; do
printf " ${RED}|- %s${R}\n" "$svc"
done
fi
if command -v ss >/dev/null 2>&1; then
section "$BLU" "Listening Ports"
printf " ${D}%-8s %-8s %s${R}\n" "PROTO" "PORT" "ADDRESS"
line
ss -tuln 2>/dev/null | awk '/^tcp.*LISTEN/{split($5,a,":"); printf " %-8s %-8s %s\n", "tcp", a[length(a)], $5}' | sort -t' ' -k2 -n | uniq | head -15 | while read -r l; do
printf "${WHT}%s${R}\n" "$l"
done
fi
if command -v sensors >/dev/null 2>&1; then
TEMP_OUT=$(sensors 2>/dev/null | grep -E 'Package id|Core|temp' || true)
if [[ -n "$TEMP_OUT" ]]; then
section "$RED" "Temperature"
echo "$TEMP_OUT" | while read -r l; do
printf " ${WHT}%s${R}\n" "$l"
done
fi
fi
echo ""
line
printf " ${GRY}Report complete. $(date '+%H:%M:%S')${R}\n"
echo ""
$
bash <(curl -sL https://r3tr0.sh/tool) --tool=info
Copy