Skip to content

Instantly share code, notes, and snippets.

@jrelo
Created October 10, 2025 15:47
Show Gist options
  • Select an option

  • Save jrelo/4cbf798b104ac337393b85b8e081f3bb to your computer and use it in GitHub Desktop.

Select an option

Save jrelo/4cbf798b104ac337393b85b8e081f3bb to your computer and use it in GitHub Desktop.
netstat -s colors stat
while true; do netstat -s | awk '/^[[:space:]]+[0-9]+/{num=$1; $1=""; desc=$0; print num"|"desc}' > /tmp/ns_new; if [ -f /tmp/ns_old ]; then clear; echo "=== Network Stats Delta ($(date +%T)) ==="; awk -F'|' 'NR==FNR{old[$2]=$1; next} {if(old[$2] && $1-old[$2]!=0) printf " \033[92m%+8d\033[0m %s\n", $1-old[$2], $2}' /tmp/ns_old /tmp/ns_new; fi; cp -f /tmp/ns_new /tmp/ns_old 2>/dev/null; sleep 1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment