Skip to content
Discussion options

You must be logged in to vote

You could use the following ping command:

nc -z -w 1 <ip> <port>; exit $?

Replace the ip and port. The command will exit 0 if port is open and exit 1 if closed. -w 1 sets a timeout of 1 second.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Firfr
Comment options

Answer selected by Firfr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants