I see many examples for nc, even one in the man page, that says

nc -zv 10-30

would report the open ports in the range 10-30. However, on my machine all the closed ports are also reported, so when I use a large range to check if any ports are open I am flooded with "connection refused" messages.

Why is the behavior on my machine different?

Should I simply filter away the verbose outut, or is there a way to let nc report only open ports?


using grep

nc -zv 1-9000 2>&1 | grep succeeded

Not the answer you're looking for? Browse other questions tagged or ask your own question.