cURL is generally know for accessing and downloading web pages or files form command line. However, there is another great feature that utilize cURL to test connectivity or access other TCP services running on other ports. A sample syntax for the command is as follows
curl -v telnet://127.0.0.1:22
Notice we use telnet as protocol to access as it good to check whether port is reachable or not. Provide any other port you want, we used 22. curl support more than 23 protocols with support of SSL. Sample output of above command is
* About to connect() to 127.0.0.1 port 22 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 22 (#0)
This is command can be used to check connectivity and also for banner grabbing. If the target port is down or reachable connection will be refused.