Show open network connections of a process

From AdminWiki

Jump to: navigation, search
  • lsof does not support selecting process and network, but you can do:
lsof -i |grep <pid|processname>

or a little bit faster:

lsof -Pnp <pid> |grep TCP
  • you can also select a certain socket type, address and port:
lsof -i 4tcp@slashdot.org:80
lsof -i 6udp@ns1.sixxs.net:53
  • netstat:
netstat -tnap |grep <pid|processname>

Category:Lsof Category:Network Category:Shell Category:Snippet Category:Debugging Category:Netstat

Personal tools