How to type telnet escape character in OS X terminal

Escape character is '^]'.

How does one type that? On Finnish/Swedish keyboard Alt-9 is ], but Ctrl-Alt-9 gives just 9.

(For non-scandinavians, [] and {} are Alt-8/9 and Shift-Alt-8/9 respectively in SE/FI keyboard)


Solution 1:

I enabled the Finnish and Swedish keyboard layouts and experimented with Terminal on OS X 10.8.5 a bit…

  • Control-å generated ^] (U+001D)
    å (LATIN SMALL LETTER A WITH RING ABOVE) is an unmodified key in these layouts.
    It is located where [ (LEFT SQUARE BRACKET) is with US layouts.

  • Control-ä generated ^[ (U+001B)
    ä (LATIN SMALL LETTER A WITH DIAERESIS) is an unmodified key in these layouts.
    It is located where ' (APOSTROPHE) is with US layouts.

  • Control-- generated ^_ (U+001F)
    - (HYPEN-MINUS) is an unmodified key in these layouts.
    It is located where / (SOLIDUS, a.k.a. “forward slash”) is with US layouts.

As normal, Control-Space generated ^@ (U+0000) and Delete generated ^? (U+007F).

I did not find any combination that generated ^\ (U+001C) or ^^ (U+001E) in Terminal though. There may be other combinations that work in other terminal emulators though (e.g. iTerm 2 in its default configuration arranges for Control with 28 generate the “non-alphabetic” control characters; this is similar to how xterm works).

Solution 2:

You can run telnet with a different escape char using telnet -e.

For instance, to use control A, type telnet -e ^A.

You may also create a file ~/.telnetrc with this contents:

DEFAULT
   set escape ^A

In both cases ^A is ^ followed by A, not control A typed directly.