Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn
Created October 20, 2023 18:34
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 ElijahLynn/a77b16d476a4e0303e6be26fc97c89dd to your computer and use it in GitHub Desktop.
Save ElijahLynn/a77b16d476a4e0303e6be26fc97c89dd to your computer and use it in GitHub Desktop.
Show all TCP connections and states (1 liner)
watch -n 1 "netstat -an | awk '/^tcp/ { ++S[\$NF] } END { for(a in S) print a, S[a] }'"
LISTEN 10
FIN_WAIT_1 253
SYN_SENT 2368
CLOSING 152
CLOSE_WAIT 2
CLOSED 27
ESTABLISHED 2282
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment