4

I'm in a mintty window of a cygwin environment.

When I typed ⎈ Ctrl+V then key I got : ^[[A

Then I ssh into Raspberry Pi, and exit immediately.

Now I type ⎈ Ctrl+V then key I get : ^[OA

~$ ^[[A
~$ ssh rasp
Last login: Tue Dec 24 12:08:16 2019 from 192.168.0.5
raspberrypi%
Connection to 192.168.0.12 closed.
~$ ^[OA

Can someone help me to understand ?

7

On login, something in the remote shell is initializing your terminal (possibly even the ssh command itself, though that would be a misfeature). The ^[[A is a normal-mode and ^[OA an application-mode (see summary in XTerm Control Sequences), and applications such as screen which initialize the terminal for full-screen operations typically use the terminal initialization capabilities in the terminal description. mintty has its own terminal description, but sets TERM to xterm. So you're getting xterm's initialization string (see xterm-basic), probably smkx:

smkx=\E[?1h\E=

which is two settings:

If this is just a case of an application setting something and not resetting it (using the same terminal description), you could follow up by

tput rmkx

(removing that mode). Doing that inside of screen or tmux would confuse the screen/tmux program; doing it inside of some other program also might not be good...

|improve this answer|||||
  • Great explanation ! even though I don't fully understand :-) One more question, is there a way to get ^[[A back after ssh ? – Philippe Dec 24 '19 at 13:30
  • 1
    For background, see unix.stackexchange.com/a/444270/5132 , unix.stackexchange.com/a/465308/5132 , and their further reading. – JdeBP Dec 24 '19 at 13:54
  • @JdeBP, How did you convert my text "Ctrl" into a symbol ? – Philippe Dec 24 '19 at 16:54
  • 1
    If you edit your answer, you'll see something like <kbd>Ctrl</kbd> which becomes Ctrl specially marked when saved (doesn 't work in comments though). – Thomas Dickey Dec 24 '19 at 17:24
  • Thanks, Thomas! – Philippe Dec 24 '19 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.