Forked from Alfreddd/open connections (sockets) for process
Created
June 25, 2023 01:54
-
-
Save gaols/7813bfd015e8abac4db4e05c1745630c to your computer and use it in GitHub Desktop.
list/count open connections (sockets) for All/certain process
This file contains hidden or 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
# list open sockets for PID | |
sudo lsof -p 13264 | egrep 'TCP|UDP' | |
# count of sockets | |
sudo lsof -p 13264 | egrep "TCP|UDP" | wc -l | |
# list the open sockets for all passengers | |
passenger-status | grep PID | awk '{ print $3}' | xargs -i sudo lsof -p {} | egrep 'TCP|UDP' | |
# Alternative command | |
sudo netstat -anp --inet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment