How do I exit telnet?

301

44

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

Val

Posted 2012-10-11T17:46:42.880

Reputation: 1

12Welcome to the trenches, nothing is "shocking" on Windows. – Pacerier – 2015-07-03T04:15:51.777

1@Pacerier telnet predates Windows, and Microsoft had excellent UI standards in the 80s and 90s. – Cees Timmerman – 2016-01-07T13:07:54.337

5The 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 – 2017-01-12T23:15:40.257

Answers

455

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.

Claudius

Posted 2012-10-11T17:46:42.880

Reputation: 6 330

21On Ubuntu Ctrl + ], quit worked for me – user1527227 – 2014-06-19T20:31:13.033

2Doesn't work. It says: Microsoft Telnet> ^] and next line shows: Invalid Command. type ?/help for help – Pacerier – 2015-07-03T04:19:10.300

@Pacerier Type quit after that to back to the dos. Good Luck. – QMaster – 2015-07-10T11:00:35.947

From CMD write telnet "hostip/name" "portnumber" then do disconnect. Press down the CTRL key and another random key on the keyboard until you find the correct one. And then write "quit" press enter. – ColacX – 2015-09-22T13:06:44.530

I never noticed that before... amazing whats right in front of your face – WernerCD – 2015-09-25T15:13:30.587

It's CTRL+$ (i tested this on windows 10)

This is the output from my console:

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+$'

Microsoft Telnet> quit

C:\WINDOWS\system32> – Kris Nobels – 2015-12-14T23:33:14.093

1... and on my German keyboard it was Strg+AltGr+9, then hit return – Abdull – 2016-02-11T16:45:34.277

9On my swedish keyboard it was Ctrl+¨ – Krycke – 2016-03-16T11:05:56.417

@Krycke The same for Swiss Keyboard, the key ] must be used with AltGr but for that purpose, we just press the Ctrl+¨ – рüффп – 2016-03-22T10:29:35.117

On German keyboar layout, press Strg + Alt Gr + 9 – Abdull – 2016-03-29T10:38:27.430

On Swiss German Keyboard it is CTRL+¨ – raudi – 2016-11-08T10:33:42.270

2On my Mac with Norwegian keyboard, ] is Alt + 9. Typing Ctrl + Alt + 9 yields 9 and is not recognised by telnet as escape character. I had to switch to U.S. input source under Keyboard --> Input Sources to be able to type Ctrl + ]. – rlovtang – 2017-05-04T10:30:53.247

To add to rlovtang's answer: The ] character on US keyboard layout is what is marked as the ^¨ key on the norwegian keyboard. – Magne – 2017-09-01T08:15:50.957

1actually, I discovered that you don't have to switch keyboard layout. With the norwegian layout it's as easy as typing: ctrl + å as you can see in the quoted answer below. Solution in other keyboard language layouts is also listed there. – Magne – 2017-09-01T08:33:51.953

In Latinamerican layout is ctrl + } – Alejandro Ruiz – 2017-11-21T22:37:34.483

1Ctrl + Ç on PT-BR keyboard – Gus – 2018-06-24T18:43:46.840

On danish keyboard for windows: As with @rlovtang suggestion of switching keyboard. Alt + Shift to switch keyboard language or select directly in the buttom right corner of the Task Bar. Then ctrl + ¨ (where ¨ results in ]) – Sonaten – 2018-10-25T11:27:23.763

with german keyboard layout on macos CTRL+OPTION+6 then type close and enter – muuvmuuv – 2019-06-17T12:00:53.913

22on Windows, run telnet with out arguments to see what the escape character is. On some localized Windows versions where ] is only available with Alt Gr key, the key combination is Ctrl++. – mihi – 2012-10-11T18:24:01.697

24As far as I remember Ctrl+5 was equivalent with ^] on my (Norwegian) keyboard. – hlovdal – 2012-10-12T08:34:29.703

5Ctrl+¨ on Windows 7 and sv/fi layout. – mkataja – 2013-11-03T00:11:29.783

101

Type quit to exit telnet in windows.

Richie086

Posted 2012-10-11T17:46:42.880

Reputation: 4 299

4Also works in Linux. – 에이바 – 2015-01-30T18:45:52.107

From @Isaac: This also works on Windows 8.1. – fixer1234 – 2015-04-20T05:21:41.743

Only this works to me. – Felipe – 2015-05-11T04:24:43.553

It didn't in linux [Centos 6.6] – Alexander – 2015-09-07T13:25:56.077

6@Alexander you have to press Ctrl + ] and only then when telnet> prompt appears enter quit. – Gacha – 2015-12-29T11:58:45.433

2For some reason I get Microsoft Telnet> ^] Invalid Command. type ?/help for help but quit works. Thanks. – Charles Clayton – 2016-02-09T00:41:15.503

This applies to the telnet interpreter, and not to a running telnet connection, that was asked for – copa017 – 2019-07-24T11:44:26.140

7Worked on MacOS X as well ;) – karlingen – 2014-06-13T07:13:31.020

28

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.

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:

  • Finnish, Swedish, Norwegian, Danish: ctrl + å
  • French: ctrl + 6
  • German: ctrl + ü
  • Swiss: ctrl + ¨
  • Hungarian: ctrl + 5
  • 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

Posted 2012-10-11T17:46:42.880

Reputation: 402

French keyboard here on Win7 with a remote session on a Ubuntu 17.10 VM via Putty. I got the telnet prompt back with ctrl+5 not ctrl+6 – Diego Tercero – 2017-12-12T13:19:53.307

4For my German keyboard it's actually ctr++, not ctr+ü – dominik andreas – 2018-02-22T12:56:21.557

2If you use Turkish Q on ubuntu CTRL + 5 is the key – Erdinç Çorbacı – 2018-10-12T09:03:12.263

1If you use latin american spanish CTRL+5 is the key too – Gustavo Arias Méndez – 2019-07-09T02:03:06.583

Doesn't seem to work in Portuguese. (Windows 10). Also, telnet says the escape char is ']', not '^]'. – D. Pardal – 2019-07-13T10:23:50.610

@D.Pardal The ^ in ^] just refers to the CTRL button, since it is marked by an ^ on the keyboard. So it just means CTRL + ] so telnet is right that the character itself is just ] – Magne – 2019-09-21T12:33:27.527

Thank @GustavoAriasMéndez in Spanish keyboard using SSL terminal conected to unix, control + 5 works! – Hernaldo Gonzalez – 2019-10-29T16:54:14.707

On Hungarian layout the key is ctrl+ú – C1sc0 – 2019-12-30T20:00:20.480

1

On debian 9, typing :

Ctrl + $

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

q

To exit

Vincent Decaux

Posted 2012-10-11T17:46:42.880

Reputation: 121