How can I quit when connected via telnet?
I have a telnet connection through askubuntu.com 80 while trying to test cli based webbrowsing for github project. I got my connection established over port 80 but now I cannot do anything, even quit. Is there a way to quit this kind of connection? CTRL+c is not working and neither is any other key combination.
Closing the tab may be the answer but this is not I want because I am planning to run a script over telnet and I do not want to install any browser like lynx or anything else. I want to use only the default programs we have in Ubuntu.
$ 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 ^C
s, 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.