Skip to content

Instantly share code, notes, and snippets.

@likejazz
Created July 6, 2019 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save likejazz/adabbd66955b7c837e857c73eb509c15 to your computer and use it in GitHub Desktop.
Save likejazz/adabbd66955b7c837e857c73eb509c15 to your computer and use it in GitHub Desktop.
Graph n of connections for each hosts
watch -n 5 "ss -an \
| grep -v 'LISTEN' | grep -v 'State' \
| awk '{print \$1\" \"\$5}' | awk -F: '{print \$1}' \
| sort | uniq -c | sort -k3 \
| awk '{ printf(\"%10s %15s %5s\t\",\$2,\$3,\$1); \
for (i = 0; i < \$1; i++) { \
printf(\"*\") \
}; \
print \"\"
}'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment