44

on Windows XP/server 2003

When telnet some remote host on a specified port, after connection established, sometimes press ctrl+] doesn't quit. Is there any command can quit instead of just close the command line window? Thanks.

EDIT: But sometimes even type ctrl + ], telnet command line doesn't show up, still stuck at the blank screen.

10 Answers 10

57

ctrl+] is an escape sequence that puts telnet into command mode, it doesn't terminate the session. If you type close after hitting ctrl+], that will "close" the telnet session.

3
  • Weird, Ctrl+] doesn't seem to work. Also, why do you type close instead of simply typing q?
    – Pacerier
    Jul 3, 2015 at 4:08
  • I think of them as "opening" and "closing" connections rather than "quitting" a session. If you run telnet by itself with no other options, you would use open host.domain.com. So to me, close is open's obvious partner and just makes more sense. However, q also works, and is certainly fewer letters :)
    – Alex
    Jul 6, 2015 at 4:06
  • close takes me to Microsoft Telnet> and q or quit takes me to C:\Windows\system32> Dec 26, 2016 at 9:37
18

on German keyboards the following keystrokes will help

CTRL + +

or rather

Strg + +

4
  • Very true. On a German keyboard <kbd>ctrl</kbd>+<kbd>]</kbd> does not (!) work. I'm sure other keyboard layouts need other combinations.
    – twigmac
    Feb 1, 2016 at 10:19
  • 1
    for swiss german it is CTRL + ¨
    – raudi
    Nov 8, 2016 at 10:32
  • For French, it's CTRL + '$' Apr 16, 2018 at 13:09
  • For Slovenian use Ctrl + č
    – Luc
    Feb 18, 2022 at 14:27
8

You can use the 'quit' command, or abbreviate it to just 'q' if you like.

3

The solution worked for me is

CTRL $

Then after when you will be in telnet invite type

quit 

then enter to exit from telnet and return to your DOS invite

2

Standard way of disconnecting the line in most applications is ~+., keep in mind, that often this has to be typed in blindly, so press enter a couple of times: Enter+~+..

This is also the standard way of closing the connection on an SSH session, that became unresponsive.

2
  • Doesn't work: Invalid Command. type ?/help for help
    – Pacerier
    Jul 3, 2015 at 4:08
  • 2
    tilde then dot was used by rlogin, and subsequently by ssh (at least on Unix); it was not and is not used by telnet. (Some programs like ed, and some protocols like SMTP and NNTP, use a line containing only dot to terminate data.) Most telnet clients, including Windows, default to ctrl-] but can be set to something else. Nov 30, 2015 at 14:23
2

I'm not terribly familiar with Windows telnet, but local behavior on non-Windows boxes using telnet is a combination of the telnet state and that of the terminal or enclosing window and shell. (If your remote connection has changed the echo mode, font color, interrupt status, and etc, killing telnet has no effect on that local status.)

Does Windows have similar local status? (I assume so, or most text editors and many other programs wouldn't work in telnet windows.)

For Unix, the typical sequence was Ctrl]quitreturnstty sanereturn to get local control and tty sanity. What's the Windows equivalent of "tty sane"?

1

ctrl+] will take you to command mode if the telnet client is already connected; from there you can type (q)uit to exit.

If it's connecting, however (or failing to connect...), then there is no way to interrupt the process until it times out.

1

On a French keyboard I have to use ctrl+$

Then 'quit' from the resulting telnet prompt.

0

maybe with ctrl + d ?

0

At least in my Linux system, the only way to exit from a telnet session is by using the following keys (pressing the 3 keys together: Ctrl, AltGr,+ and then the following prompt appears: telnet> Now press the key q and the telnet session will be terminated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .