Use netcat instead of telnet

Network engineers often use telnet to establish a connection to a service on a remote server. Apple dropped the telnet and ftp client in macOS High Sierra. First I was very disappointed, but realistically telnet is history.

Instead of trying solutions to get telnet back, look forward and start using netcat.

Connect to a webserver and get the headers:

nc -v 80

Then type your GET request for / with a minimal  host header.

GET / HTTP/1.1 [enter]
Host: [enter]

and you get the result

Connection to port 80 [tcp/http] succeeded!
GET / HTTP/1.1
HTTP/1.1 503 Service Unavailable
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 268
Expires: Sun, 18 Feb 2018 15:09:36 GMT
Date: Sun, 18 Feb 2018 15:09:36 GMT
Connection: keep-alive
<TITLE>Service Unavailable</TITLE>
<H1>Service Unavailable - DNS failure</H1>
The server is temporarily unable to service your request.  Please try again later.<P>

This method can be used for all ports. You can also get the headers for mail servers, ssh servers.

If you only want to know if the port is open, simply use:

nc -vz 80

You can also use netcat to verify if  UDP ports are open:

nc -vz -u 53

And netcat can be used as a port scanner:

nc -vz <hostname or ip address> 1-1000