Ubuntu – How to quit when connected via telnet

command linetelnet

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.

Best Answer

$ 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.

Related Question