Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'View programs' connections (open sockets)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View programs' connections (open sockets)
Authored by: hrbrmstr on Mar 21, '05 11:20:20AM

lsof -r -i TCP -i UDP

will do the same and repeat the process endlessly (remove "-r" to do it once).

Should be on every box, but you might need to install fink first.

---
Mind the gap...



[ Reply to This | # ]
View programs' connections (open sockets)
Authored by: ershler on Mar 21, '05 12:25:47PM

I like this one a lot. Thanks for the hint.

Phil



[ Reply to This | # ]
View programs' connections (open sockets)
Authored by: msk on Mar 21, '05 02:32:04PM

lsof -r -i TCP -i UDP

and

sockstat

generate completely different output. Big difference between sockets and ports.



[ Reply to This | # ]
View programs' connections (open sockets)
Authored by: hrbrmstr on Mar 21, '05 04:00:02PM

they both provide the same info with the correct options. I listed three (for brevity). lsof shows all file descriptors...socket==file descriptor. so, in fact, lsof is a more robust tool.

lsof rocks. folks who can't type "man lsof" before posting replies don't...

---
Mind the gap...



[ Reply to This | # ]
Even easier...
Authored by: jtrott on Mar 21, '05 10:38:14PM

Try lsof -i4
Or lsof -6 for TCPv6 connections.



[ Reply to This | # ]
Minor tweak...
Authored by: MattHaffner on Mar 22, '05 03:43:19PM

You'll want to run this with root permissions ('sudo lsof...') if you want to see all the connections on your machine. As a user, it only shows connections opened by processes started by your user ID.



[ Reply to This | # ]