0

I have a specific PID and my question is how can I know which port belongs to that PID. Any tips on how to know the port of a service that has a specific PID? Thanks a lot.

1

1 Answer 1

0

One can use lsof with the -i (only list IPv4/6), -P (no port names), and -n (no hostnames) arguments, and then grep the PID:

sudo lsof -i -P -n | grep <PID>

This will present you with all ports the service might be using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.