468

I start telnet by telnet host port. How do I stop it in Windows? Shockingly, Ctrl+C doesn't work.

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
Val
  • 1
  • 7
  • 20
  • 39
  • 19
    Welcome to the trenches, nothing is "shocking" on Windows. – Pacerier Jul 03 '15 at 04:15
  • 5
    @Pacerier `telnet` predates Windows, and Microsoft had excellent UI standards in the 80s and 90s. – Cees Timmerman Jan 07 '16 at 13:07
  • 8
    The reason Ctrl+C doesn't interrupt or suspend the connection is that an interrupt signal or a Ctrl+C often needs to be passed through to the remote end (so you can break programs there, if you're working on a remote shell), which wouldn't be possible if the telnet client intercepted it for its own purposes. – blubberdiblub Jan 12 '17 at 23:15

5 Answers5

682

It should have printed something along the lines of:

Escape character is '^]'.

Since ^X is CtrlX, try Ctrl] for ^].

You should then enter the telnet console, where you can enter quit to leave telnet.

Pacerier
  • 26,733
  • 82
  • 197
  • 273
Claudius
  • 8,808
  • 1
  • 15
  • 13
162

Type quit to exit telnet in windows.

Indrek
  • 24,204
  • 14
  • 90
  • 93
Richie086
  • 5,152
  • 12
  • 42
  • 65
60

The ^] means ctrl + right bracket. As strange as that is, it works. You'll be taken to the telnet prompt, where you can type quit or simply q.

On international keyboards the ] character is often not a single key, and needs to be replaced with some other key. The correct key is typically the key to the right of P or the next key after that.

Here's a list based on comments below:

  • Norwegian: ctrl + å
  • Danish, Finnish, and Swedish: ctrl + ¨ [added by Fredrik C]
  • French: ctrl + 6
  • German, Turkish: ctrl + ü
  • Swiss: ctrl + ¨
  • Hungarian: ctrl + 5 or ctrl + ú
  • Portuguese: ctrl + ´
  • Dutch, Belgian: ctrl + $
  • Canadian French: ctrl + ç
  • Italian: ctrl + +

Quote from @jtbandes answer here: https://superuser.com/a/427/192525 All creds to him.

PS: Answer reproduced here for your convenience, since google took me to this question first, and none of the other answers here was sufficient for my case. The question How to send the escape character on OS X terminal? could be seen as a duplicate (more generic version) of this question, since the OP's problems are basically the same.

Magne
  • 726
  • 5
  • 9
9

On debian 9, typing :

Ctrl + $

Allows you to show the prompt from telnet, then only type :

q

To exit

Vincent Decaux
  • 201
  • 3
  • 6
2

all previous answers correct but for this worked:

Ctrl + ]

then I typed

quit
grepit
  • 213
  • 1
  • 6