Map open port to process [duplicate]
Possible Duplicate:
Finding the process that is using a certain port in Linux
How may I find out which process(daemon) is listening on a given port if I do not have a service that would specifically listen on that port? For example if port 10101 is open how can I close the respective process?
02 Answers
You can use lsof (list open files) to get the Process ID.
E.g. lsof | grep 10101
Then use can get the process name from /proc (cd /proc/processIDnumber).
You can do netstat -tulpn and grep for the name of the port.
For instance, using your example port, the command would be netstat -tulpn | grep 10101