Is it possible to list all processes which connected to particular ip and port?

I want to list the processes which connected to Particular IP and port. Is there any command to achieve this?

Take a look at ss which is a replacement for the old netstat

For example:

 ss -atp

As root, will list all current TCP connections on the server with processes names and PIDs.

man ss for more options.

Best regards

Answered By: ob_dev

With lsof:

lsof -nPi @

(add -t if your only want the process ids).

That lists sockets bound to that address as well.

With ss (from iproute2 on Linux):

ss state established dst 'dport = :443'

With PSMisc’s fuser:

fuser -n tcp ,,443
fuser -n udp ,,443

However note that it (at least version 22.21 here) won’t report the IPv6-mapped IPv4 addresses, you’d need separate queries for those:

fuser -n tcp ,::FFFF:C0A8:017B,443

(::FFFF:C0A8:017B being the IPv6-mapped version of

Answered By: Stéphane Chazelas

The format is:

lsof -i [tcp|udp][@hostaddr][:[service name|port]]


lsof -i TCP@

See lsof(8).

Answered By: Sreedhar
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.