As pointed by B. Rhodes, nc
(netcat
) will do the job. A more compact way to use it:
nc -z <host> <port>
That way nc
will only check if the port is open, exiting with 0 on success, 1 on failure.
For a quick interactive check (with a 5 seconds timeout):
nc -z -v -w5 <host> <port>