Last active
September 14, 2018 06:44
-
-
Save radleta/a197d16fac316f5d0278a82dd7a3e91d to your computer and use it in GitHub Desktop.
Get the host names of the machines connected via TCP in Bash
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
netstat | grep ESTABLISHED | sed -E 's/tcp[0-6]*\s+[0-9]+\s+[0-9]+\s+[a-z0-9]+(\.[0-9a-z]*)*:([0-9a-z]+)\s+//' | sed -E 's/(\.[a-z]*)*:[-a-z0-9]+\s+ESTABLISHED//' | sort | uniq -c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment