Arrow keys in Putty returning ^[[A ^[[D ^[[B instead of moving the cursor

Has anyone else ever had this error in PuTTy?

For example, pressing the Up Key now produces:

>>> ^[[A

Google doesn't let you search for special characters so I'm stumped at finding existing version of this problem.


EDIT:

So this happened after I pasted in some unicode (when, I think, the translation was already set to utf-8).

I've checked the Change Settings dialog box for different settings than my other open PuTTy windows, but the settings appear to be identical.

EDIT2:

This is fixed by restarting PuTTy, but still a nuisance.

EDIT3:

How to replicate the exact same bug:

  1. Open a putty terminal to a linux PC (I'm using RedHat)
  2. Open Python 2.7.* - using the command python2.7 (note: error does not appear in 2.6)
  3. import codecs
  4. Now use the arrow keys, and these bizarre characters appear.
76065 次浏览

You could try changing the 'Application Cursor Keys' mode. It's in the Terminal->Keyboard subsection of the initial configuration window (these settings may potenitally be overridden by your server).

http://the.earth.li/~sgtatham/putty/0.55/htmldoc/Chapter4.html#S4.4.4

For those interested in the issue, had same simptoms in a virtualenvironment, resolved the issue with

pip install readlines

See following answer for details.

In my experience that's because "bash" is not running. Simply run "/bin/bash" to enjoy colors, history and more.

Just run the simple bash command or sudo bash in ssh. It usually works.

I've found that specifying "The Function Keys and Keypad" option to match your operating system resolves many issues.

[Putty]

Terminal -> Keyboard --> RadioButton "Linux"

(if you're using Linux) and then you can start your session

Terminal >>> Local line editing >>> Force off

See also