How to check how many connections are open currently on a specific TCP port

connectionsnetworkingtcp

I'm doing some comet benchmarks and would like to see how many open connections I have.

Actually I use netstat:

netstat -ant | grep 8080 | grep EST | wc -l

But it needs around 4-6 minutes to list the number, is there any tool that can do show it in real time?
The number of open connections is between 100'000 – 250'000.

Best Answer

Don't know if lsof is better, but give this a try:

lsof -ni:8080 -sTCP:ESTABLISHED | wc -l