Reputation: 11637
I have a big java system on unix with many subsystems (email, connection etc..) that listen on many ports, but i dont know which of my classes\subsystems listen to which port.
Is there a tool that can help me figure this out?
example: this is what i get when i run netstat, and i dont know what in my java system is using port 2503 and what 2505
>netstat -nap |grep 250
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2503 0.0.0.0:* LISTEN 26659/java
tcp 0 0 0.0.0.0:2505 0.0.0.0:* LISTEN 26659/java
Upvotes: 1
Views: 143
Reputation: 216
Once you have the PID, you can use ps
ps -Af |grep 26659 |less
The -f option will show not only the program (java) that is using the port, but also the command line used to start it. So if you have multiple java processes running, and each are started as a separate task, you will see which one is using the port.
You will probably want to view the result in "less" so you can scroll the very long command lines common to java.
Upvotes: 0
Reputation: 5648
The same PID/app is using 2 ports. You have your answer.
You will have to be MUCH more specific on your problem given the fact that the answer is so obvious based on the information provided; I can only assume this isn't what you're looking for
Upvotes: 1