bash - Quick way to find if a port is open on Linux - Stack Overflow
You can use netcat for this.
nc ip port < /dev/null connects to the server and directly closes the connection again. If netcat is not able to connect, it returns a non-zero exit code. The exit code is stored in the variable $?. As an example,
nc ip port < /dev/null; echo $? will return 0 if and only if netcat could successfully connect to the port.
Read full article from bash - Quick way to find if a port is open on Linux - Stack Overflow
No comments:
Post a Comment