Last active
February 1, 2016 22:50
-
-
Save lukaszx0/d23b50f5b9e3fa91fd29 to your computer and use it in GitHub Desktop.
pid to port
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
#!/bin/bash | |
# Prints ports used by given process (PID) | |
# | |
# Usage: | |
# pid2port 123 | |
function pid2port() { | |
lsof -Pan -p $1 -i | awk '{print $1,$3,$4,$8,$9}' | |
} |
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
~/Development/foobar> pid2port 1687 | |
COMMAND USER FD NODE NAME | |
java lukasz 27u TCP 127.0.0.1:59906->127.0.0.1:25101 | |
java lukasz 29u TCP *:22299 | |
java lukasz 30u TCP *:22280 | |
java lukasz 43u TCP *:22243 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment