nc
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 -w5 <host> <port>; echo $?
Comments
Post a Comment
https://gengwg.blogspot.com/