Show open network connections of a process

From AdminWiki

(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
-
* lsof does not support selecting process /and/ network, but:
+
* lsof does not support selecting process ''and'' network, but you can do:
  lsof -i |grep <pid|processname>
  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:
  netstat -tnap |grep <pid|processname>
  netstat -tnap |grep <pid|processname>
{{Category:lsof}} {{Category:network}} {{Category:shell}} {{Category:snippet}} {{Category:debugging}} {{Category:netstat}}
{{Category:lsof}} {{Category:network}} {{Category:shell}} {{Category:snippet}} {{Category:debugging}} {{Category:netstat}}

Latest revision as of 13:21, 8 May 2009

  • 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