Identify processes that have open sockets
In Category Linux Networking
The lsof can be used to find the list of processes that have active sockets open.
Let us see the list of current TCP connections using netstat command.
[liz@techpulp ~]# netstat -nt Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 192.168.20.24:40816 74.125.19.83:80 ESTABLISHED tcp 0 0 192.168.20.24:43059 74.125.19.83:80 ESTABLISHED [liz@techpulp ~]#
Now let us find which process has these TCP sockets open using lsof command.
[liz@techpulp ~]# /usr/sbin/lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
firefox-b 3288 liz 13u IPv4 157814 TCP
liz.techpulp.com:43058->cf-in-f83.google.com:http (ESTABLISHED)
firefox-b 3288 liz 40u IPv4 158205 TCP
liz.techpulp.com:43059->cf-in-f83.google.com:http (ESTABLISHED)
[liz@techpulp ~]#
So Firefox has two active sockets open to google.com
Recent Comments