cURL With Specific Port

Posted Under: cURL, Linux, Tutorials on Oct 1, 2019
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://
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 port 22 (#0)
*   Trying
* Connected to ( 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.