How can I quit when connected via telnet?

$ telnet askubuntu.com 80
Trying 151.101.1.69...
Connected to askubuntu.com.
Escape character is '^]'.

That last line is the clue. Control+] busts you back to the main telnet prompt. From there you can run quit or Control+D to exit.

That said, throwing a load of rubbish at the Ask Ubuntu server (like a pile of ^Cs, followed by Return) does still see the server respond (by closing the connection).

$ telnet askubuntu.com 80
Trying 151.101.129.69...
Connected to askubuntu.com.
Escape character is '^]'.
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

Connection closed by foreign host.

What you're describing makes it sound like that isn't the case. If that's really the situation, I'd load another terminal and killall telnet (assuming no other sessions you want to preserve), or just close the terminal emulator you'd been running this in and make a new one.


Given what you are trying to do the best way is

$ telnet askubuntu.com 80
Trying 151.101.129.69...
Connected to askubuntu.com.
Escape character is '^]'.
GET /path/to/whatever HTTP/1.1
Host: askubuntu.com
Connection: close

HTTP/1.1 200 OK ...

<HTML><HEAD> ...
</BODY></HTML>
Connection closed by foreign host
$

You probably won't see your side of the conversation when you type it in and if you're like me you make a lot of typos and there's no way to fix them; but when you go to make the here script that problem won't exist.