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
    You can use ss or lsof Commented Sep 23, 2022 at 20:36

1 Answer 1

1

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.