Last active
January 20, 2024 22:49
-
-
Save ElijahLynn/501e556b450cd6bfc868c384ca742155 to your computer and use it in GitHub Desktop.
Monitor the number of all TCP connection states
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch -n 1 "netstat -an | awk '/^tcp/ { ++S[\$NF] } END { for(a in S) print a, S[a] }'" | |
# Every 1.0s: netstat -an | awk '/^tcp/ { ++S[$NF] } END { for(a in S) print a, S[a] }' | |
# LISTEN 7 | |
# FIN_WAIT_2 1 | |
# CLOSE_WAIT 1 | |
# CLOSED 33 | |
# TIME_WAIT 1 | |
# ESTABLISHED 63 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment